-
-
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] Use WeakMap to store tracked property values.
Using a `Symbol` causes issues on IE11 when using the core-js polyfill. Specifically, the polyfill adds every symbol to `Object.prototype` and therefore our `if (symbol in this) {` check was completely borked. Migrating to a `WeakMap` exposed another issue: we were accidentally relying on the fact that the symbols would be inherited through the prototype chain. This meant that setting a tracked property on a prototype would actually affect the value seen by every instance of that prototype. For example: ```js class Thing { @Tracked baz; } Thing.prototype.baz = 'foo'; let thing = new Thing(); console.log(thing.baz) ``` Before the changes in this commit, the above console.log would emit `foo` and after these changes it would print `undefined`.
- Loading branch information
Showing
3 changed files
with
30 additions
and
24 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