-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX] Ensure QP definitions interop with tracked props #18358
[BUGFIX] Ensure QP definitions interop with tracked props #18358
Conversation
This PR ensures that QPs can autotrack getters/setters and tracked props. It includes a couple of manual flushes of async observers in order to support legacy sync behaviors of QPs.
529feee
to
7f29c04
Compare
Dismissing because the PR has been updated, and requested changes are no longer relevant
addObserver(key, target, method) { | ||
addObserver(this, key, target, method); | ||
addObserver(key, target, method, async) { | ||
addObserver(this, key, target, method, async); |
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.
We really need a test for this (unrelated to query params)
// Some QPs have been updated, and those changes need to be propogated | ||
// immediately. Eventually, we should work on making this async somehow. | ||
if (EMBER_METAL_TRACKED_PROPERTIES && qpUpdated === true) { | ||
flushAsyncObservers(false); |
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.
It is not clear to me at all why we need to sync flush here. Can you make an issue for us to track removing this (likely evaluating the specific failing test that caused it to be made sync)?
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.
For reference, the failing tests were:
<LinkTo /> component with query params (routing): the <LinkTo /> component applies activeClass when query params are not changed
{{link-to}} component with query params (routing): the {{link-to}} applies activeClass when query params are not changed
removeObserver(key, target, method) { | ||
removeObserver(this, key, target, method); | ||
removeObserver(key, target, method, async) { | ||
removeObserver(this, key, target, method, async); |
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.
Needs a specific test, for users of observable (not related to query params).
[BUGFIX] Ensure QP definitions interop with tracked props (cherry picked from commit 0efdae9)
[BUGFIX] Ensure QP definitions interop with tracked props (cherry picked from commit 0efdae9)
[BUGFIX] Ensure QP definitions interop with tracked props (#18358)
This PR ensures QPs can be defined with native getters/setters or tracked properties. QP observers have been updated to always fire asynchronously, except in a few cases in the router's internals where we flush manually because we need to propagate changes immediately.