Ember route's model hook doesn't re-fired when qp change

We recently upgraded to Ember 3.8 and noticed that it messed up a few things in routes. I’m not sure if it’s an actual issue with Ember or something that we did wrong to begin with, so any comments/answers would be welcome.

Understanding: We have a queryParams object with a few properties which have refreshModel: true. We’d expect that once we transitionTo({ queryParams: {...newProps } }), we’ll refire the model hook.

To be very clear, the first time we enter the route, we set undefined to all props in qP. And we transtionTo (with values) through our callbacks.

Behavior: We do see the url being changed with params, but somehow the model hook is overlooked and is not triggered. This is easily traceable as I have 2 versions of my app, one with Ember 3.8 and one with Ember 3.5.1. Model hook is re-fired in Ember 3.5.1, but not in 3.8.

Question: Being new to Ember, I would like to get some feedback on if my understanding is correct? If yes, then has anyone else noticed model hook not being fired when qp (refreshModel: true) change? And is there a way to fix it?

This is not my understanding on how queryParams work. Could you provide some code or better an ember-twiddle that shows the unexpected behavior? Maybe that night help better explain your expectations and where your mental model differs from mine.

2 Likes

You need to configure the query param to trigger a full refresh:

Thanks for the reply. We’ve configured our queryParams exactly that way. @sukima I’m sorry if that wasn’t clear but we’ve followed this part of the documentation. But as mentioned in the docs, model is never triggered in 3.8

Can you provide an ember-twiddle demonstrating this? If your code is 100% correct then you have discovered a bug that needs a reproducible example. Otherwise there is a subtle piece missing that a reproducible example will offer others an oppertunity to diagnose for you.

Sure, I’ll get back with a working example. Thanks

@sukima Hey, so I thought this problem was caused because we recently upgraded from v3.5.1 to v3.8.0. But the problem seems to be introduced in v3.6.0. And upgrading to 3.8 doesn’t solve it.

Here is a simple ember addon engine where we are routing through our dummy app.

Ours is a pretty complex app with where we have engines inside engine. So any comments on how to solve this type of error would be awesome. Thanks!

@neeleshsaxena Have you tried moving the action to the controller? I would try defining your queryParams in the controller and moving the action in there. Then doing a set for the sid param.

@lvegerano Thanks for the reply. That does not work. And we do queryParams defined in the controller.