Skip to content

Commit

Permalink
[BUGFIX beta] Fix this in @tracked initializer
Browse files Browse the repository at this point in the history
Fixes #18690
  • Loading branch information
chancancode committed Jan 29, 2020
1 parent f323419 commit feaf337
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 105 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@
},
"devDependencies": {
"@babel/preset-env": "^7.7.7",
"@glimmer/compiler": "0.47.1",
"@glimmer/compiler": "0.47.3",
"@glimmer/env": "^0.1.7",
"@glimmer/interfaces": "0.47.1",
"@glimmer/node": "0.47.1",
"@glimmer/opcode-compiler": "0.47.1",
"@glimmer/program": "0.47.1",
"@glimmer/reference": "0.47.1",
"@glimmer/runtime": "0.47.1",
"@glimmer/validator": "0.47.1",
"@glimmer/interfaces": "0.47.3",
"@glimmer/node": "0.47.3",
"@glimmer/opcode-compiler": "0.47.3",
"@glimmer/program": "0.47.3",
"@glimmer/reference": "0.47.3",
"@glimmer/runtime": "0.47.3",
"@glimmer/validator": "0.47.3",
"@simple-dom/document": "^1.4.0",
"@types/qunit": "^2.5.4",
"@types/rsvp": "^4.0.3",
Expand Down
5 changes: 3 additions & 2 deletions packages/@ember/-internals/metal/tests/tracked/get_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ moduleFor(

'@test should get a @tracked path'() {
class Key {
@tracked value = 'value';
key = 'some-key';
@tracked value = `value for ${this.key}`;
}

class Path {
Expand All @@ -39,7 +40,7 @@ moduleFor(

let obj = new Obj();

this.assert.equal(get(obj, 'path.key.value'), 'value');
this.assert.equal(get(obj, 'path.key.value'), 'value for some-key');
}

['@test should get arbitrary properties on an object']() {
Expand Down
37 changes: 37 additions & 0 deletions packages/@ember/-internals/metal/tests/tracked/validation_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,43 @@ moduleFor(
assert.equal(validate(tag, snapshot), true);
}

[`@test autotracking should work with initializers`](assert) {
class Tracked {
@tracked first = `first: ${this.second}`;
@tracked second = 'second';
}

let obj = new Tracked();

let tag = track(() => obj.first);
let snapshot = value(tag);

assert.equal(obj.first, 'first: second', 'The value initializes correctly');
assert.equal(validate(tag, snapshot), true);

snapshot = value(tag);
assert.equal(validate(tag, snapshot), true);

// TODO: https://github.com/glimmerjs/glimmer-vm/pull/1018
// obj.second = '2nd';

assert.equal(validate(tag, snapshot), true);

assert.equal(obj.first, 'first: second', 'The value stays the same once initialized');
snapshot = value(tag);

assert.equal(validate(tag, snapshot), true);

obj.first = 'FIRST!!!';

assert.equal(validate(tag, snapshot), false);

assert.equal(obj.first, 'FIRST!!!');
snapshot = value(tag);

assert.equal(validate(tag, snapshot), true);
}

[`@test autotracking should work with native getters`](assert) {
class Tracked {
@tracked first = undefined;
Expand Down
190 changes: 95 additions & 95 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -801,138 +801,138 @@
resolved "https://registry.yarnpkg.com/@ember/edition-utils/-/edition-utils-1.1.1.tgz#d5732c3da593f202e6e1ac6dbee56a758242403f"
integrity sha512-GEhri78jdQp/xxPpM6z08KlB0wrHfnfrJ9dmQk7JeQ4XCiMzXsJci7yooQgg/IcTKCM/PxE/IkGCQAo80adMkw==

"@glimmer/compiler@0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.47.1.tgz#15de7acd90103e352ea1b7de13480e963ebb3798"
integrity sha512-BobPTnvklRtaiBhuoUK0smhrtgUXpK5ra6NJA493QVjuVH2Cs2JKPR02j+Mg1lRa5BfGEgp+gN7bXmj7nfhfzA==
dependencies:
"@glimmer/interfaces" "^0.47.1"
"@glimmer/syntax" "^0.47.1"
"@glimmer/util" "^0.47.1"
"@glimmer/wire-format" "^0.47.1"
"@glimmer/compiler@0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/compiler/-/compiler-0.47.3.tgz#6017f00d64cb8a665067ba86a38e95dde5952ea6"
integrity sha512-I43J+1fUIgLCGOjZ0BllNDcgiCkwCFkVK2pV3znhWD0l2zxWyNWAxu0S1XLc8iw9yhm3H0NfzIeADWhBDAw2eg==
dependencies:
"@glimmer/interfaces" "^0.47.3"
"@glimmer/syntax" "^0.47.3"
"@glimmer/util" "^0.47.3"
"@glimmer/wire-format" "^0.47.3"
"@simple-dom/interface" "^1.4.0"

"@glimmer/encoder@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.47.1.tgz#fb4a6bd5eef52e0188af4b576c7f7dcec02ec891"
integrity sha512-Easb+ihktU8Cuo0awJNNaSp1Do5FrETKn6bwIfRYiC1ssH666wVyAyifxLzGE9goYBpAwbJIz+hh1ayKeOxpaw==
"@glimmer/encoder@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/encoder/-/encoder-0.47.3.tgz#52c4920310b6a641d2622bc64f751c93b69172b5"
integrity sha512-WxFHveKXaVOPWJha10QrQItZNkHmtQDWovAImvOJ1tVJP0n1lApxDPmHWm8JxHAAz3rAXdWP7BE+cXpADWAGCw==
dependencies:
"@glimmer/interfaces" "^0.47.1"
"@glimmer/vm" "^0.47.1"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/vm" "^0.47.3"

"@glimmer/env@0.1.7", "@glimmer/env@^0.1.7":
version "0.1.7"
resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07"
integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc=

"@glimmer/interfaces@0.47.1", "@glimmer/interfaces@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.47.1.tgz#19056a44f7fb6e6130685bc68b806ab8fb48dd75"
integrity sha512-ONU/RZYAeNrhh0pXC+0rXUA7AkRqCvitWXjbaVHHF/CVvpi+m2aVsFADF4RROSoDlHKfxkULM33eEJzNnRfWSw==
"@glimmer/interfaces@0.47.3", "@glimmer/interfaces@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.47.3.tgz#cbe70af51fe9779e273f5fc5c4df82fb44220cc4"
integrity sha512-5woCzbLqzes9ZMu0Kw16Ukt8ZiMPTqfkNuQPQSZHD/sCS6xg3TRNghrBz8GSv525p5g5x4TjdOl6JoTUzf/qlw==
dependencies:
"@simple-dom/interface" "^1.4.0"

"@glimmer/low-level@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/low-level/-/low-level-0.47.1.tgz#5444f39cd68b51d3658954404e910e29a342eb90"
integrity sha512-B8KrexS54ys+UJFDPcQ/hivnwOg2PCeiunkdB8RCiXBHPtKk9DIHgs6Aqht7TlRI1GPN83TgcJEWUO5xQbf+cw==
"@glimmer/low-level@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/low-level/-/low-level-0.47.3.tgz#aea34ef892b0d2b2c8b1f095e9ae5c1e6bc2e7ba"
integrity sha512-k/E8CNwpAOQmID3uBVhYiHK8GJta+Puqn0abErZmRMbOY8LFwLJVJ/ga8HqKj6R8w220EKBl+HZEenvy3GS+PA==

"@glimmer/node@0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.47.1.tgz#95fe40cd9bda39dd513a2b66c18f0a79ce54e0f9"
integrity sha512-7O0KZ2uSF5VifDvHyfspcUtZUnhxAg18egydhjezsPgwGo9mtMVQzNVQYB9PDboRLzLr5lb1YXGltN3g3yWjZg==
"@glimmer/node@0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/node/-/node-0.47.3.tgz#99e9134cbda9e64647be789abe93b77ec722c468"
integrity sha512-eeXLl8jUJhmcAa9EwJeCf4n/KH93XQjAlv+eFVmpEBu4jXuN/3TrgnMqArMpnvthFJNn/k3mBepEifamfQU4KA==
dependencies:
"@glimmer/interfaces" "^0.47.1"
"@glimmer/runtime" "^0.47.1"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/runtime" "^0.47.3"
"@simple-dom/document" "^1.4.0"
"@simple-dom/interface" "^1.4.0"

"@glimmer/opcode-compiler@0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/opcode-compiler/-/opcode-compiler-0.47.1.tgz#8c3b16f2d2ab5538887900a845289f6fae587de4"
integrity sha512-XONSonkSBip0o/L1oZ46d2lm+x6nJlYzX/rWQAAhwDJlmKGkr1VM8AKYcNo2Ue0h6hZL/QUbteh7EZNi/mWhLg==
dependencies:
"@glimmer/encoder" "^0.47.1"
"@glimmer/interfaces" "^0.47.1"
"@glimmer/program" "^0.47.1"
"@glimmer/reference" "^0.47.1"
"@glimmer/util" "^0.47.1"
"@glimmer/vm" "^0.47.1"
"@glimmer/wire-format" "^0.47.1"

"@glimmer/program@0.47.1", "@glimmer/program@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.47.1.tgz#83bed74b025eccc772ff691cbbf419836ccabe07"
integrity sha512-iyYD7onwnQwTtcr6iNn9uUTD3l93sO7+RLcPYVrtWffZYRt1238WQ10dUX7M48vs/bphfWRWNQLJf38Tew5Jdw==
dependencies:
"@glimmer/encoder" "^0.47.1"
"@glimmer/interfaces" "^0.47.1"
"@glimmer/util" "^0.47.1"

"@glimmer/reference@0.47.1", "@glimmer/reference@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.47.1.tgz#fc9eab768eb0d2ae84ef86e07d59677f669bd6d3"
integrity sha512-2xdVI9q/eIGyNyN6+hifqwqafI4eIjuDygik27SMXo7XPSZTi0xZC146fqSrMXxWjtvk82q7aJLPL+vbKWez8w==
"@glimmer/opcode-compiler@0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/opcode-compiler/-/opcode-compiler-0.47.3.tgz#a9e139ebf3ea6db11cdc43ce69dfbde962218b2c"
integrity sha512-v02O6GlzJN/W3c9WJaM1iUxXvC5hKgBfT+UQ4KUeLc/VF1TqJ1UhwcCUNrTrq685DmgMoBDWmv0/1zNU2lKl1Q==
dependencies:
"@glimmer/encoder" "^0.47.3"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/program" "^0.47.3"
"@glimmer/reference" "^0.47.3"
"@glimmer/util" "^0.47.3"
"@glimmer/vm" "^0.47.3"
"@glimmer/wire-format" "^0.47.3"

"@glimmer/program@0.47.3", "@glimmer/program@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/program/-/program-0.47.3.tgz#9e6a29ee447b6c05460cb2d572b54bd5fdb0f5e7"
integrity sha512-MN24uNA5fwMoA9x7JYs5oxVjP5I0zhTjSxcgXFIk6scyKmSqsX3fGXjYzBfeZ4cVyoaRJSykOm0UkTO56K+S1w==
dependencies:
"@glimmer/encoder" "^0.47.3"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/util" "^0.47.3"

"@glimmer/reference@0.47.3", "@glimmer/reference@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.47.3.tgz#34e879de392a54b19324fe6784e1b1c153a3ce4a"
integrity sha512-F7A92ZcxvkJJvMjwuOgA5EUBpHb2mxHorqNlLUHoxSRfhCgYBKkUqdtEsK6PEKra4uAEFwNJDE0K4CxRXai4nA==
dependencies:
"@glimmer/env" "^0.1.7"
"@glimmer/util" "^0.47.1"
"@glimmer/validator" "^0.47.1"
"@glimmer/util" "^0.47.3"
"@glimmer/validator" "^0.47.3"

"@glimmer/runtime@0.47.1", "@glimmer/runtime@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.47.1.tgz#c3907be5b1c32f1986004ed821c4c04d7a4d44ef"
integrity sha512-Xo62BobqztNA4D4vv0MZpJ56ChEhZyMKLWepDIPjgJsXTKjUU80L2MV5Mnj+bnzP88WEEu6zaKuSVczH3AtxXg==
"@glimmer/runtime@0.47.3", "@glimmer/runtime@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/runtime/-/runtime-0.47.3.tgz#67c0a7d2c20c7b1768e3eb7d9e3ce4a10941b294"
integrity sha512-eCS4ucIcKKHr0Ys17uteNH6J6lUIRAK6gr3DW5CT26EpvJ+mCLSHu1Eu6vXrUmXztfRENVuMkPVanJ0qkiwknA==
dependencies:
"@glimmer/env" "0.1.7"
"@glimmer/interfaces" "^0.47.1"
"@glimmer/low-level" "^0.47.1"
"@glimmer/program" "^0.47.1"
"@glimmer/reference" "^0.47.1"
"@glimmer/util" "^0.47.1"
"@glimmer/validator" "^0.47.1"
"@glimmer/vm" "^0.47.1"
"@glimmer/wire-format" "^0.47.1"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/low-level" "^0.47.3"
"@glimmer/program" "^0.47.3"
"@glimmer/reference" "^0.47.3"
"@glimmer/util" "^0.47.3"
"@glimmer/validator" "^0.47.3"
"@glimmer/vm" "^0.47.3"
"@glimmer/wire-format" "^0.47.3"
"@simple-dom/interface" "^1.4.0"

"@glimmer/syntax@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.47.1.tgz#e23513413b12e9b1e8adf1fea5f012c15f05e126"
integrity sha512-6LdBY/g2n5BETgGkneH9jpszAYlOKTqLTeoOsZXp2o+OmEzG0o2h1c6OGckJRuqma4/eodevwAVcB66057fVjQ==
"@glimmer/syntax@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.47.3.tgz#8082b5e354f27defd3307e78538db41a8df45294"
integrity sha512-cR9F8aiEBRJptA1/rzuDQ3HSBfHidCcT3zZJ1n3NF1TwTwxtV1xzAMhXaU3laRMm1LMHsPG5jnNOjsII/NR4xw==
dependencies:
"@glimmer/interfaces" "^0.47.1"
"@glimmer/util" "^0.47.1"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/util" "^0.47.3"
handlebars "^4.5.1"
simple-html-tokenizer "^0.5.8"

"@glimmer/util@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.47.1.tgz#d356c85febc2c5bb33c448efe48cdccd46b2620f"
integrity sha512-VtsRyx8vTMzEaAimE4CW2n2lIrBn0qFLRs+bvSSTGsjQHkHiFbIltDqOhQ7H9fBZM6Y3vV4niSkMlc8Q9yIc6g==
"@glimmer/util@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.47.3.tgz#9d104e54d301e03707ea2228431e373529284d55"
integrity sha512-2zFJIoqE4OxsEZkRi0tlHgjkL65AKcXNMTnBDsFSf7tLA0+Z58G18tM7mqijbZLZkwxA6/+uVpE/uGj0NbT24Q==
dependencies:
"@simple-dom/interface" "^1.4.0"

"@glimmer/validator@0.47.1", "@glimmer/validator@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.47.1.tgz#86fc06edbb40013e6bee5cae4a8810a3f361391a"
integrity sha512-Ik3hWOxBoBnDtokd1ewMC//afdQqrwNnGW2zuAUzOFNOrU7SKZCZxcBNELTdWbXtUh8op0SAYTy76joz+c5f4g==
"@glimmer/validator@0.47.3", "@glimmer/validator@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.47.3.tgz#09722d88b2023b4e26632ab3e5ed9dacdbb5f3b2"
integrity sha512-k7By19cTMFR53LtXsAwk/Ezrny4Md1YXTNdVqD8fXMOmA0xF5iiK+5s6TFaxxxtk08LKNKgU1x6x8L+2gR0TiA==
dependencies:
"@glimmer/env" "^0.1.7"

"@glimmer/vm@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.47.1.tgz#962a429540229173e7677ff48bfa0c9edc7f5156"
integrity sha512-sXg6cF/swrGwmQVtmiMNmrvPiBM3bVIn3ZJRlRR2hEfCKbsAKnth39j7W8Fj/AoeTvndvvL0gYzPxFBSknamow==
"@glimmer/vm@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/vm/-/vm-0.47.3.tgz#0086952717944dc38d883567c78850f6861f55e3"
integrity sha512-3KMuT+CXbDjTDFXHBjc7nid9iDBupj7SFAwDkmkuMErmrUjCf+j9N5R/jhJuljRI8KA2N1W4EMzGDkHBz1kpow==
dependencies:
"@glimmer/interfaces" "^0.47.1"
"@glimmer/util" "^0.47.1"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/util" "^0.47.3"

"@glimmer/wire-format@^0.47.1":
version "0.47.1"
resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.47.1.tgz#b9ad8118468675f307e27f4a78ba70fb32040327"
integrity sha512-xNBOP7cjize+wTVINO0sA6EV7GQnvKeyS64210KxGR2SmNzKM1LcijaJzchFIS/0+p75SdlJZ9Pf1/ALr5rHzA==
"@glimmer/wire-format@^0.47.3":
version "0.47.3"
resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.47.3.tgz#16699818745f290520edfad5bd5dab94cd08b012"
integrity sha512-nu+c1SrVAwyMeGuBNTCSoh/0qL0Fb0SYYZdLkd5xO8FxWjB4zgyJKwI2DpnBcIk4ymzyD1LcviU1HbYyrpiT8w==
dependencies:
"@glimmer/interfaces" "^0.47.1"
"@glimmer/util" "^0.47.1"
"@glimmer/interfaces" "^0.47.3"
"@glimmer/util" "^0.47.3"

"@simple-dom/document@^1.4.0":
version "1.4.0"
Expand Down

0 comments on commit feaf337

Please sign in to comment.