-
-
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.
[bugfix] Prevents the recursive redefinition of root chains
This fix prevents an edge case where recursive call to `writableChains` causes the root `_chains` ChainNode on a meta to be overwritten, resulting in a chains node that does not match up with the `watching` state of the meta. This can occur when: 1. A computed property has been setup on a class, which lazily delays finalizing chains. 2. An observer is then added to the class, which eagerly forces its dependencies to setup their chains. In the case observed, it was only triggered because there were some number of intermediate aliases between the `computed` and the `observer`. Aliases are not volatile, but they also don't use the computed cache for values so they cannot rely on `getCachedValueFor` when setting up chains. This results in eager fetching of computed values, which leads to the nested recursive call. This PR solves the problem by ensuring that the root chain node is set on the meta before we attempt to add any values to it (e.g. with `copy`). The copy method has been renamed to `copyTo` to indicate that it is not actually creating or returning a copy (open to suggestions for a better name).
- Loading branch information
Showing
3 changed files
with
58 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
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