-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Removes Chains in Tracked Properties Flag
This PR updates the tracked properties feature flag to fully remove chains. This was primarily is response to core issues we found with interop with computed properties, which required us to make computed properties and observers more lazy in general. At a high level, these are the major changes: * The `getCurrentTracker`/`setCurrentTracker` system was a leaky abstraction, since errors could cause a child tracker to never reset. In order to make it more bulletproof, it has been changed to `track`/`consume`/`isTracking`. We wrap any change to the stack of trackers with a `try/catch` to make sure we always clean up in `track`. `isTracking` is used only when we don't want to eagerly create a tag if there is no tracking context. * Observers have been made asynchronous. They now flush during specific phases of the runloop - just before render, and potentially after render if anything was scheduled (this will begin a new runloop). They poll now to check if any changes occured, rather than firing synchronously when the change occurs, which is how we made them work entirely using tags without chains. Observers inherited from EmberObject classes begin polling at the same time as `finalizeChains`. * Computed properties have been updated to only use chains when checking for dirtiness. Since computed properties were lazy before, this isn't much of a change overall. Computed properties also no longer autotrack, unless they have been marked by a (currently private) `_auto()` modifier. * Both observers and computeds accomplish this laziness by following and reading the tags of their dependencies _after calculation_. They entangle all dependencies at this point, _unless_ the dependency is an uncalculated computed property. If they encounter one of these, they setup _lazy chains_, which will be followed and updated the next time the computed property is calculated. This also makes aliases lazily observe. * Computed properties have also been updated to install a native setter, per the track props update RFC. * Query parameters use synchronous observers to update various things. They should really be refactored, but that's going to take a while. In the meantime, we flush the observers synchronously for them specifically. * A `UNKNOWN_PROPERTY_TAG` system has been added _privately and internally only_. This system allows proxies to return a special tag that invalidates when their _content's_ properties change. This system could be made more public in the future, but it is purposefully private for the time being. It was necessary to match existing semantics in many tests. * A new mandatory setter system has been added. This system is now one-way - once a value has been consumed, there is no way to remove the setter and "unconsume" it. This is the nature of tags being lazy and having no teardown. There were a few additional changes that were required as well: * `visit` and `transitionTo` for application tests had to be made async in order to work properly with observers. Most of the work occured in another PR, but some had to be finished up here. * Many, many tests needed to be updated. Most of these were for the fact that observers are now async, and required us to wait on the runloop settling.
- Loading branch information
Chris Garrett
committed
Apr 26, 2019
1 parent
ffb453b
commit 4cdbb8c
Showing
91 changed files
with
3,760 additions
and
2,542 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
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
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
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
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
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
Oops, something went wrong.