emberjs / emberjs/ember.js

[Bug] Route dynamic segment is lost in aborted transition

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

Description

### 🐞 Describe the Bug
A route's dynamic segment is lost when beginning to transition to another route, resulting in an error if the user attempts to transition to a child route before the original transition completes.

### 🔬 Minimal Reproduction
* visit a route w/ a dynamic segment and at least two child routes
* begin to transition to another route
* before the transition completes, transition to one of the two child routes
* observe the "You must provide param `[dynamic-segment]` to `generate`" error in your console

Ember Twiddle: https://ember-twiddle.com/16ec907953fc96f368cddfab88676bed?openFiles=templates.application%5C.hbs%2C&route=%2Fparent%2F123456

### 😕 Actual Behavior
If the user attempts to navigate to another route, the current route's template remains visible until the other route's model has loaded. This leaves a window of time in which the user might decide to instead click on a still visible child route's link, resulting in an error since the parent route has (presumably) been torn down and its dynamic segment lost.

### 🤔 Expected Behavior
If the parent route's template is still displayed (and links to its child routes are still clickable), then clicking on those links should work because the dynamic segment is still accessible.

### 🌍 Environment

- Ember: - 3.20
- Node.js/npm: - 14.18.1/6.14.15
- OS: - Mac
- Browser: - Chrome

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.