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.

TransitionTo with queryParams refreshModel triggers model calls on other routes

See original GitHub issue

Description

It appears that calling transitionTo with queryParams on a nested route can trigger calls to the lower route if that route has a refreshModel: true on an unchanged queryParam. Reproduction

So I have this setup: somewhere -> somewhereParam with refreshModel: true with default null somewhere.nested -> nestedParam

In somewhere.nested I have a component which triggers a transition on the router service where nestedParam is changed. This trigger the model on somewhere to be called and then transitioning through the controller then triggers another call.

Cause

I did some digging and it appears that the call to route#finalizeQueryParamChange returns the incorrect values, because the transition._keepDefaultQueryParams isn’t set. This is set in router#transitionTo, but only after the call. The call does return a promise, so transition._keepDefaultQueryParams = true may actually be executed in time, but I found this to be very flaky.

I’m more than willing to help fix this, however it is embedded so deeply that I find it difficult to pick the right approach.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:24
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
Boudewijn26commented, Dec 20, 2017

@rwjblue This bug is currently 50 days old. While I understand effort is currently going to Ember 3.0, I hope we can get this fixed within reasonable time for the LTS releases.

1reaction
kurkowskicommented, Apr 29, 2019

I just came across this bug on Ember 3.3. Using the router service’s transitionTo method in a component would cause the transitioned-to route’s model hook to be called twice. My workaround was to pass an action defined in the controller down to the component and use the controller’s transitionToRoute method which does not seem to have the bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transition to same route with other query params - Ember.JS
If I submit a new search the same route like /marketplace/customers?c=321&email=aaa@bbb.de will be triggered but the model() method will not be ...
Read more >
Triggering model hook when transitioning to same route with ...
I want to refetch 10 conversations from my back-end (so I always have at least 10 conversations) but with the same queryParam itemCount...
Read more >
Ember Query Params. Introduction | by Michael Jan Schiumo
In other words, the query params are updated, but Route methods like model or setupController are not called. If we do want to...
Read more >
Routing: Query Parameters - Ember.js - GitHub Pages
However, sometimes you need to serialize other application state into the URL. This could be further parameters that affect the loading of the...
Read more >
Building a Bookstore App with Ember Data
First thing we'll do is generate a route to show our books and another route to ... findAll call is an asynchronous Ember...
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