Skip to content

Support a lifecycle hook that runs prior to bindings being torn down. #328

@justinbmeyer

Description

@justinbmeyer

In this codepen, <child-comp> is trying to change it's viewModel when it is being removed from the page.

However, the parent<my-counter> is not updated. This is because the binding is torndown prior to the event being dispatched. The bindings teardown somehow needs to be delayed. It's likely we need to run a batch around before remove.

Adding a batch around beforeremove does not seem to help. The updates likely happen too late (in DOMUI). Perhaps child->parent updates should happen in Notify?

A quick fix is to pass a compute that sets your property down to the child. The child can then set that compute:

https://codepen.io/justinbmeyer/pen/rPQBRv?editors=0011

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions