Fix incompatibility with {{each}} and frozen objects #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit, the Glimmer.js implementation of the VM's
Iterable
interface relied on using anUpdatableReference
from@glimmer/object-reference
. Unfortunately,@glimmer/object-reference
was an experimental implementation that was never meant to be used outside an experimental context. Nonetheless, certain classes, particularlyUpdatableReference
have found their way in use throughout the system, including here and perhaps most noticeably throughout the Glimmer VM test suite. One of the shortcomings of the implementation is incompatibility with frozen objects, because it eagerly tries to store metadata on objects.A production-ready version of the functionality in
@glimmer/object-reference
was written for tracked properties in@glimmer/component
. Because we never made that functionality publicly available, however, people tended to just use theobject-reference
version.This commit makes the following changes:
RootReference
,CachedReference
,UpdatableReference
andConditionalReference
from@glimmer/component
.@glimmer/application
Iterable
implementation to use this version ofUpdatableReference
.{{each}}
helper, testing frozen and non-frozen variations of string literals, number literals and objects.In the future, we are planning to move the
Reference
subclasses provided by@glimmer/component
intoglimmer-vm
so they are both more discoverable and more easily shared across host environments, particularly Ember.js and Glimmer.js.