-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix waitlist to ensure ready() is correct before next flush
Issue #742
- Loading branch information
Showing
1 changed file
with
16 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6922224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cmather you still need to trigger and invalidation if line 131 here makes
self._notReadyCount
go to zero. Otherwise there are situations where it'll be wrong.I expanded the test case to fail again.
The TLDR:
The DR:
There's a legit use case where this is bad. It's not too complicated:
waitOn
.Router.current().ready()
is false for a bit, then true. The wait list is waiting on one handle.waitOn
. Now,Router.current().ready()
is briefly false. This can trigger weird and unexpected behaviour.I haven't traced it through exactly in my use case but it seems pretty obvious that this problem could happen if you "change" the state of the waitlist (by decrementing
_notReadyCount
) without triggering achanged()
event. It feels like a house of cards to rely on some other code running to "fix" the wrong-ness, as:a) there's guaranteed to be a time period where it's wrong, and
b) it's more or less guaranteed to be edge cases where the problem is never "fixed".
6922224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is your recommended solution to check whether self._notReadyCount has changed and if so change the outer
readyDep
?6922224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well if it changed and went to 0, yes.
6922224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I added that change and the test is passing. I'm preparing a 0.9.2 release to use newer versions of iron:layout and iron:dynamic-template relating to Blaze changes that are coming this week.
6922224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.