-
-
Notifications
You must be signed in to change notification settings - Fork 33
Ensure did-update
only re-runs when arguments change (avoid recomputing when tracked properties update within callback)
#54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a4f7e8a
to
bc012f7
Compare
Is this fixing the issue I described here by any chance? |
Yes, this patch should fix that! |
addon/modifiers/did-update.js
Outdated
@@ -1,5 +1,6 @@ | |||
import { setModifierManager, capabilities } from '@ember/modifier'; | |||
import { gte } from 'ember-compatibility-helpers'; | |||
import { untrack } from '@glimmer/validator'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how this import will work for ember-source < 3.27, in versions prior to 3.27 these sorts of internal ember modules were hidden and not available for import...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approved the CI run, so we should see those failures (in 3.24 at least)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the Ember 3.12 ember-try scenario:
not ok 5 Chrome 96.0 - [38 ms] - Integration | Modifier | did-update: it basically works
---
stack: >
Error: Could not find module `@glimmer/validator` imported from `@ember/render-modifiers/modifiers/did-update`
at missingModule (http://localhost:7357/assets/vendor.js:259:11)
at findModule (http://localhost:7357/assets/vendor.js:270:7)
at Module.findDeps (http://localhost:7357/assets/vendor.js:180:24)
at findModule (http://localhost:7357/assets/vendor.js:274:11)
at Module.findDeps (http://localhost:7357/assets/vendor.js:180:24)
at findModule (http://localhost:7357/assets/vendor.js:274:11)
at requireModule (http://localhost:7357/assets/vendor.js:36:15)
at ModuleRegistry.get (http://localhost:7357/assets/vendor.js:67734:14)
at Class._extractDefaultExport (http://localhost:7357/assets/vendor.js:68170:41)
at Class.resolveOther (http://localhost:7357/assets/vendor.js:67830:32)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a commit that should resolve this issue...
Modifier capabillities in 3.22, requires all arguments to be consumed, to be tracked. This meant `disableAutoTracking` had to be set to `false` for the modifier to work with 3.22 capabillities. This had the sideeffect that any other consumed tags ended up being tracked. Meaning the `did-update` callback was invoked whenever those tags changed.
57268a9
to
95a3fe5
Compare
@@ -27,6 +27,7 @@ | |||
"test:ember-compatibility": "ember try:each" | |||
}, | |||
"dependencies": { | |||
"@embroider/macros": ">= 0.48.1 < 2.0.0-alpha.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@embroider/macros
is "stable", this ensures that we can continually get the most recent version (and don't force an app to end up with a bunch of versions due to our dependency).
95a3fe5
to
94b3132
Compare
cf434e3
to
8dd14c7
Compare
did-update
callback in an untracked framedid-update
only re-runs when arguments change (avoid recomputing when tracked properties update within callback)
Modifier capabillities in 3.22, requires all arguments to be consumed,
to be tracked. This meant
disableAutoTracking
had to be set tofalse
for the modifier to work with 3.22 capabillities. This had the
sideeffect that any other consumed tags ended up being tracked. Meaning
the
did-update
callback was invoked whenever those tags changed.