Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order of oncreate in sibling components #1137

Merged
merged 4 commits into from
Jan 26, 2018
Merged

Fix order of oncreate in sibling components #1137

merged 4 commits into from
Jan 26, 2018

Conversation

Rich-Harris
Copy link
Member

This fixes #1135 by running oncreate hooks (and associated beforecreate and aftercreate) front to back instead of back to front. We have to tweak the initialisation code to preserve the depth-first behaviour, which people might be relying on (there's a test that says as much).

This does change one piece of behaviour in a way that might be unexpected — if you have uninitialised bindings like this...

{{#if x}}
  <Foo bind:y/>
{{else}}
  <Bar bind:y/>
{{/if}}

...the binding of y will initialise to the opposite value than what it did before. Uninitialised bindings inside conditionals is a terrible idea that is easily fixed by the user, so I don't feel bad about that.

@Rich-Harris Rich-Harris merged commit 3cd9779 into master Jan 26, 2018
@Rich-Harris Rich-Harris deleted the gh-1135 branch January 26, 2018 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

oncreate order should reflect component order
2 participants