[Bug] <RouterService>#transitionTo incorrectly re-runs the the model hook when query params do not change
See original GitHub issue🐞 Describe the Bug
- have queryParams
- configure the query params to
refeshModel: true
- navigate to a child route with the router service’s transitionTo
- notice that the parent route’s model hook re-runs
🔬 Minimal Reproduction
😕 Actual Behavior
the parent model hook is re-running (in the application route in the repro)
🤔 Expected Behavior
the parent model hook should not run (as with the transitionToRoute behavior)
🌍 Environment
- Ember: - Octane+
- Node.js/npm: - n/a
- OS: - n/a
- Browser: - n/a
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Changing query params in transitionTo doesn't seem work
I am in my application route and have query-params defined in its controller. To make things more concrete, let's say they are city...
Read more >useState with URLs: How to persist state with useSearchParams
The React useState Hook is a great way to persist state inside the URL query string, building on top of the React Router...
Read more >Ember change queryParameters from an action in a controller
... up the wrong tree or not. Depending on how you have your query params configured in the route (do you have refreshModel...
Read more >Using Query Parameters (AWS Signature Version 4)
A use case scenario for presigned URLs is that you can grant temporary access to your Amazon S3 resources. For example, you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I came across a behavior which may be related to this bug. The context is as follows:
parent route – child route ---- component
The parent route’s controller has a
queryParam
. The component needs to update thatqueryParam
and usesthis.router.transitionTo({ queryParams: { prop: value }});
to do so. ThequeryParam
prop is being modified, which is different than this bug report, but the child routemodel
hook is still being triggered.To work around the issue I now call
this.transitionToRoute({ queryParams: { prop: value }})
on the child route’s controller. Themodel
hook is no longer run again in this case.Also experiencing this issue on Ember 3.28.11, Ember 4.4.4 and Ember 4.9.2
Having to stick with Controller.transitionToRoute for certain calls to avoid slow page transitions