ember.js icon indicating copy to clipboard operation
ember.js copied to clipboard

Active route after `transition.retry()`

Open dguettler opened this issue 8 years ago • 7 comments

I'm storing a Transition in order to return to that route at a later point.

Expected

transition.retry() should returns me to this route and set correct state.

Current observed behavior

After calling transition.retry() from an action on another route I am returned to the route, the URL changes however the wrong links have the active class

Example

https://ember-twiddle.com/50588f2e4afc9cb99a74bc3eada38a81

Version

Ember 1.12+ ... alpha

dguettler avatar Jul 17 '17 17:07 dguettler

@alexspeller thanks for taking a look

dguettler avatar Jul 17 '17 17:07 dguettler

Probably related to #10557, #13164

dguettler avatar Jul 17 '17 17:07 dguettler

active link classes get properly restored if I call

this.router.set('targetState.routerJsState', transition.state)

before calling transition.retry()

dguettler avatar Jul 17 '17 19:07 dguettler

I'm running into the same issue on the latest ember (2.14.x) - the workaround described by @dguettler doesn't seem to work for me. Still experimenting and trying to reproduce a twiddle.

In our case, we have a mixin that does a transition.abort() followed by a transition.retry() 50ms later in the willTransition hook of a route. (this is so we can nicely render a loading animation before the transition for a more seamless experience and avoid UX lockup).

The active state on link-to when switching between a route, just changing the positional parameter for model_id, fails every time (all links with the route, even with different model_ids, gain the active class).

I confirmed that removing the mixin fixes the problem, but am looking for a workaround to force ember to recompute the link-to active states, even if it's a hack for now

EDIT: Here's a twiddle reproducing my issue, along with a workaround

https://ember-twiddle.com/128d462ce1fa0acdebd696338ca3dc14?openFiles=templates.application.hbs%2C

Workaround found here: https://github.com/emberjs/ember.js/issues/10557

kjhangiani avatar Aug 14 '17 03:08 kjhangiani

I am also seeing this behavior on a EULA acceptance route I configured in ember. The redirect itself works fine, but the link active states are incorrectly displaying to the user.

nmcclay avatar Sep 06 '17 16:09 nmcclay

Still happens with ember-3.8.0

fpauser avatar Mar 28 '19 13:03 fpauser

Still a problem in 5.5.0.

Here is a reproduction on stackblitz https://stackblitz.com/edit/ember-cli-editor-output-vbtcxx

evoactivity avatar Jan 18 '24 22:01 evoactivity