Updating one query param causes the other QP to reset to its default value
Closed this issue · 2 comments
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 returnsundefined
.
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. 😭
Sorry, wrong project.
Posted here: emberjs/ember.js#14438