question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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

Twiddle

😕 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:open
  • Created 2 years ago
  • Reactions:8
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
trevordevorecommented, Apr 17, 2021

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 that queryParam and uses this.router.transitionTo({ queryParams: { prop: value }}); to do so. The queryParam prop is being modified, which is different than this bug report, but the child route model hook is still being triggered.

To work around the issue I now call this.transitionToRoute({ queryParams: { prop: value }}) on the child route’s controller. The model hook is no longer run again in this case.

0reactions
Techn1xcommented, Dec 21, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found