emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.45k stars 4.21k forks source link

[3.13] Query Params not updating when refreshing route #18479

Open jrohrbaugh opened 5 years ago

jrohrbaugh commented 5 years ago

Ember-twiddle with a simplified re-creation of the issue github repo with a new ember app containing the same code

We've been using the route's refresh method (documented here) to reload the route's model. refresh gets called by a route action, which is in turn called by a controller action. The controller action modifies the value of a query param, which is then accessed via the route model hook's params argument.

We noticed a change in this pattern's behavior when upgrading from 3.12 to 3.13. The model hook is no longer picking up the updated query-param value; it's using the original value instead. Ember-twiddle doesn't support recent Ember versions, so the logs there are giving the expected result. I created a fresh app using the same code: it defaulted to 3.11 and I observed the expected result, then I upgraded to 3.13 and the result changed. See the difference in the query param's value here:

ember 3 11 ember 3 13

While debugging, I was able to get the expected behavior on 3.13 by wrapping the call to the refreshRoute action inside of a setTimeout of 0ms - going from

this.send('refreshRoute');

to

setTimeout(() => {
   this.send('refreshRoute');
}, 0);

so this could possibly be a queuing issue?

eliel-jr commented 4 years ago

Hi!

I'd the same problem in ember 3.14

solutions??

ahmetemrekilinc commented 4 years ago

We are facing same problem in version ember 3.16

jrohrbaugh commented 4 years ago

We just updated our ember version to 3.20 and are still experiencing the issue. We'll probably just end up refactoring our code to not use query params under these specific circumstances