emberjs / emberjs/ember.js

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

Open
#16,992 3 comments 2 reactions 0 assignees View on GitHub
Has Reproduction Routing
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.