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

Updating one query param causes the other QP to reset to its default value #194

Closed
lolmaus opened this issue Oct 10, 2016 · 2 comments
Closed

Comments

@lolmaus
Copy link

lolmaus commented Oct 10, 2016

I'm building an Ember 2.8 app and I've got an issue with two query params on a controller. They behave fine until I add a child route with an async model hook AND a loading template. Then updating one property on parent controller causes the other property to reset to its default value, and vice versa. Changes to child route's QPs also result in reset of parent route's QPs.

I was able to narrow down the issue to this line:
https://github.com/emberjs/ember.js/blob/3141f835991dee848a4983eb064bfab54fd2e473/packages/ember-routing/lib/system/router.js#L830

          queryParams[qp.scopedPropertyName] = appCache.lookup(cacheKey, qp.prop, qp.defaultValue);

When one QP has a non-default value, and you edit the other QP, the following happens:

  • If you the child route's model hook is sync (or if there's no loading template on child level), then this line returns the current value of the non-edited QP.
  • If the child route's model is async AND there's a loading template, then the line returns the default value of the non-edited QP, which causes the controller property to reset to its default value. If I pause execution at this point and call appCache.lookup(cacheKey, qp.prop) without the third argument, it returns undefined.

I'm unable to reproduce it on Twiddle: it behaves as expected (and it did behave correctly in all my previous apps as well). But in my app it reproduces with stubborn persistence.

I'm at a loss. I haven't heard about appCache yet and I have no idea why it's failing for me.

Please help. 😭

@lolmaus
Copy link
Author

lolmaus commented Oct 10, 2016

Sorry, wrong project.

@lolmaus lolmaus closed this as completed Oct 10, 2016
@lolmaus
Copy link
Author

lolmaus commented Oct 10, 2016

Posted here: emberjs/ember.js#14438

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

No branches or pull requests

1 participant