Ember.js: Router `transition.retry` with dynamic segments and `refreshModel` queryParams causes unexpected error

Created on 19 Sep 2018  ·  3Comments  ·  Source: emberjs/ember.js

Seems related to #10945.

My use case is: when a user tries to navigate with an expired token (by leaving the window open long enough) the API calls will fail with a unauthorized error. We added some logic to the Applications's error action to catch this type of error, re-authenticate the user and retry the transition after the authentication. The problem is that when I try to transition.retry() to a route with dynamic segments and query parameters with refreshModel, it will fail with the below error:

You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route [route name]

If I set my query param to refreshModel: false, it works fine.

Here's a reproducible twiddle: https://ember-twiddle.com/e25fc434b6e1c1627e553b8120203655?openFiles=routes.dynamic-segment.js%2C
You can see the error when clicking on the 'Dynamic segment with query param' link. If you change the refreshModel to false on /routes/dynamic-segment.js it works.

Any help is appreciated. Thanks!

Has Reproduction Router Bugs

Most helpful comment

@krukid - The issue you mention seems somewhat unrelated to the original one being discussed here (I think). Would you mind filing a new issue for that?

@rreckonerr recently fixed a somewhat related bug (where we would not thread through the original values when doing intermediate transitions), this seems somewhat related. I think the first step here would be to make a failing test case over in router.js...

All 3 comments

I am experiencing something similar when trying to transition.retry() a Transition that was triggered by a Route.refresh() where queryParamsOnly: true

I guess this is somehow related to #16921

I find that Route#refresh() produces a transition that cannot be retried if there are dynamic segments.

Here's my use case: https://ember-twiddle.com/6d2f981f6628a3260db8cafd3b3aac0a?openFiles=routes.flopping-route%5C.js%2C

@krukid - The issue you mention seems somewhat unrelated to the original one being discussed here (I think). Would you mind filing a new issue for that?

@rreckonerr recently fixed a somewhat related bug (where we would not thread through the original values when doing intermediate transitions), this seems somewhat related. I think the first step here would be to make a failing test case over in router.js...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SaladFork picture SaladFork  ·  4Comments

escobera picture escobera  ·  3Comments

nathanpalmer picture nathanpalmer  ·  3Comments

MichalBryxi picture MichalBryxi  ·  3Comments

dfreeman picture dfreeman  ·  4Comments