Skip to content
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

Merged
merged 2 commits into from
Sep 13, 2019

Conversation

pzuraq
Copy link
Contributor

@pzuraq pzuraq commented Sep 5, 2019

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.

rwjblue
rwjblue previously requested changes Sep 6, 2019
packages/@ember/runloop/index.js Outdated Show resolved Hide resolved
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.
@pzuraq pzuraq force-pushed the bugfix/ensure-query-params-work-with-tracked-props branch from 529feee to 7f29c04 Compare September 11, 2019 19:18
@pzuraq pzuraq dismissed rwjblue’s stale review September 13, 2019 16:55

Dismissing because the PR has been updated, and requested changes are no longer relevant

@pzuraq pzuraq merged commit 0efdae9 into master Sep 13, 2019
@pzuraq pzuraq deleted the bugfix/ensure-query-params-work-with-tracked-props branch September 13, 2019 17:00
addObserver(key, target, method) {
addObserver(this, key, target, method);
addObserver(key, target, method, async) {
addObserver(this, key, target, method, async);
Copy link
Member

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);
Copy link
Member

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)?

Copy link
Contributor Author

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);
Copy link
Member

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).

wycats pushed a commit that referenced this pull request Sep 17, 2019
[BUGFIX] Ensure QP definitions interop with tracked props

(cherry picked from commit 0efdae9)
wycats pushed a commit that referenced this pull request Sep 17, 2019
[BUGFIX] Ensure QP definitions interop with tracked props

(cherry picked from commit 0efdae9)
rwjblue added a commit that referenced this pull request Sep 17, 2019
[BUGFIX] Ensure QP definitions interop with tracked props (#18358)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants