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

**URL:** https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361
**Category:** Routing
**Created:** [March 25, 2019, 4:48pm UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361 "2019-03-25T16:48:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![neeleshsaxena](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@neeleshsaxena](https://discuss.emberjs.com/u/neeleshsaxena)
#### Post date: [March 25, 2019, 4:48pm UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/1 "2019-03-25T16:48:10Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![sukima](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/sukima/32/5773_2.png) [@sukima](https://discuss.emberjs.com/u/sukima)
#### Post date: [March 26, 2019, 2:09am UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/2 "2019-03-26T02:09:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![francesconovy](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/francesconovy/32/9607_2.png) [@francesconovy](https://discuss.emberjs.com/u/francesconovy)
#### Post date: [March 26, 2019, 9:41am UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/3 "2019-03-26T09:41:51Z")

</div>

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

> **[Query Parameters - Routing - Ember Guides](https://guides.emberjs.com/release/routing/query-params/#toc_opting-into-a-full-transition)**
>
> Query parameters are optional key-value pairs that appear to the right of the ? in a URL. For example, the following URL has two query params, sort and page, with respective values ASC and 2: 
> 
> http://example.com/articles?sort=ASC&page=2  
> 
> Query...

---

<div class="post-metadata">

### Author: ![neeleshsaxena](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@neeleshsaxena](https://discuss.emberjs.com/u/neeleshsaxena)
#### Post date: [March 26, 2019, 1:53pm UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/4 "2019-03-26T13:53:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sukima](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/sukima/32/5773_2.png) [@sukima](https://discuss.emberjs.com/u/sukima)
#### Post date: [March 26, 2019, 2:06pm UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/5 "2019-03-26T14:06:52Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![neeleshsaxena](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@neeleshsaxena](https://discuss.emberjs.com/u/neeleshsaxena)
#### Post date: [March 26, 2019, 2:22pm UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/6 "2019-03-26T14:22:08Z")

</div>

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

---

<div class="post-metadata">

### Author: ![neeleshsaxena](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@neeleshsaxena](https://discuss.emberjs.com/u/neeleshsaxena)
#### Post date: [March 27, 2019, 3:37am UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/7 "2019-03-27T03:37:19Z")

</div>

@sukimaHey, 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.

> **[GitHub - neeleshsaxena/emberRouteBug: Ember addon that depicts a route bug](https://github.com/neeleshsaxena/emberRouteBug)**
>
> Ember addon that depicts a route bug. Contribute to neeleshsaxena/emberRouteBug development by creating an account on GitHub.

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!

---

<div class="post-metadata">

### Author: ![lvegerano](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/lvegerano/32/13973_2.png) [@lvegerano](https://discuss.emberjs.com/u/lvegerano)
#### Post date: [March 27, 2019, 6:59pm UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/8 "2019-03-27T18:59:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![neeleshsaxena](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@neeleshsaxena](https://discuss.emberjs.com/u/neeleshsaxena)
#### Post date: [March 27, 2019, 9:48pm UTC](https://discuss.emberjs.com/t/ember-routes-model-hook-doesnt-re-fired-when-qp-change/16361/9 "2019-03-27T21:48:01Z")

</div>

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