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

Two-way binding observers not initialised in some circumstances #708

Closed
Rich-Harris opened this issue Jul 11, 2017 · 3 comments
Closed

Two-way binding observers not initialised in some circumstances #708

Rich-Harris opened this issue Jul 11, 2017 · 3 comments
Labels

Comments

@Rich-Harris
Copy link
Member

Another wild bug courtesy of @TehShrike. Repro here.

Essentially what happens is this:

  • The oncreate function is successfully called for each <Top> component, and component.get('top') is correct
  • Next comes bindings. The first binding is created (for the final component, because the order shouldn't really matter here), and that causes component._set(...) to happen (component being App.html in this case), which triggers an update of the main fragment, which causes top to become undefined for the remaining <Top> components, because their bindings haven't been initialised yet so idToTop is incomplete
  • By the time the second and third bindings are initialised, the differs check returns false, because the value of top is undefined, which means the observer is not initialised.

So somehow we need to prevent the _set from causing the update. If we can figure that out, then we'll also be saving some unnecessary work from happening (the top-level component could update just once, instead of three times).

Answers on a postcard...

@TehShrike
Copy link
Member

Should there be a separate issue created for the binding-in-an-array-with-a-key-when-the-keys-change issue?

On that topic, remembering this thing from chat, I tried doing this to work around that issue, but it didn't seem to help.

@Rich-Harris
Copy link
Member Author

@TehShrike not 100% sure I understand what that issue is, but it sounds like the answer is 'probably' 😀

@TehShrike
Copy link
Member

That was the "I need to use keyed list iteration" issue - I'll open a different issue for the issue I found with keyed blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants