-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Ensure
hash
properties are reified lazily
`(hash)` previously had two different types of behavior, one where it was used as a reference and could get individual properties lazily, and one where it was fully reified and exposed in JS. The lazy nature of hash was very useful as it prevented having to realize the full cost of each reference immediately, and it also meant that some values could be accessed in conditionals and run assertions just in time. For example, if someone was using a component that was loaded lazily via an engine, you could render the component on a hash within a conditional and it would not cause an error (because the component did not exist): ```hbs <SomeComponent as |api|> <api.eagerComponent/> {{#if this.displayLazy}} <api.lazyComponent/> {{/if}} </SomeComponent> ``` This PR restores this ability by having `(hash)` return a proxy rather than an object, which allows us to access each individual value without reifying the references immediately. For backwards compatibility, we also allow users to set values on the proxy, so long as they are not setting any of the values defined on the proxy initially, since those are read-only references.
- Loading branch information
Chris Garrett
committed
Apr 22, 2021
1 parent
5c4def2
commit 5ce55ac
Showing
2 changed files
with
156 additions
and
4 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