Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{link-to}} transitioning classes are incorrect after transition.abort() #13164

Open
GavinJoyce opened this issue Mar 22, 2016 · 16 comments · Fixed by #13169
Open

{{link-to}} transitioning classes are incorrect after transition.abort() #13164

GavinJoyce opened this issue Mar 22, 2016 · 16 comments · Fixed by #13169

Comments

@GavinJoyce
Copy link
Member

twiddle: https://ember-twiddle.com/8aa9da800a7883b6c59a?openFiles=routes.page2.js%2C

The ember-transitioning-in and .ember-transitioning-out classes don't seem to be updated correctly when linking to a route that aborts the transition:

export default Ember.Route.extend({
  beforeModel: function(transition) {
    return delay(1000).then(function() {
      transition.abort();   
    });
  }
});

I'll try to create a failing test now

@GavinJoyce GavinJoyce changed the title {{link-to}} classes are incorrect after calling transition.abort() {{link-to}} transitioning classes are incorrect after transition.abort() Mar 22, 2016
@GavinJoyce
Copy link
Member Author

possibly related: #10195

@GavinJoyce
Copy link
Member Author

Failing test: #13165

@GavinJoyce
Copy link
Member Author

@rwjblue perhaps you could reopen this issue due to #13262?

@rwjblue rwjblue reopened this Apr 5, 2016
@rwjblue
Copy link
Member

rwjblue commented Apr 5, 2016

Good point. Reopened.

@pixelhandler
Copy link
Contributor

@kjhangiani
Copy link

Just got bit by this issue, found via #15518. Is there a workaround to force ember to recompute link-to active states? The workaround mentioned in that ticket does not seem to work for me.

@kjhangiani
Copy link

So, this was somewhat of a rabbithole. I was able to reproduce the specific issue I was having on a twiddle here:

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

In particular, my issue was due to a transition.abort() followed by an Ember.run.later(transition, transition.retry, 50) in the willTransition hook of a route. The problem was specifically when changing between the same route, with just a positional param model_id change.

I found a workaround here: #10557 which thankfully works (essentially replaces transition.retry with a this.transitionTo)

In my digging, I found a number of related tickets, linking them all here - these all seem related to me:
#10557 (solution found here)
#10195
#13164
#12419
#15158
#15518
https://discuss.emberjs.com/t/transitionto-not-applying-active-class-to-link-to-elements/12266/6

There are a number of twiddles / jsbins across those issues that reproduce different variations of the issue. They all seem related to a transition.abort breaking things, however.

Hopefully this helps identify the issue. We were experiencing it in our production app on the latest ember (2.14.x), but it has been an issue for us for quite some time. I was previously working around it by using jquery to fix the classes, I only just now spent the time to investigate why it was occurring.

@buschtoens
Copy link
Contributor

Also experiencing this issue all of a sudden. Probably since upgrading some dependencies. I'll try to reproduce it.

@locks
Copy link
Contributor

locks commented Feb 24, 2018

Closed by #13169

@locks locks closed this as completed Feb 24, 2018
@GavinJoyce
Copy link
Member Author

@locks is the link to the PR above incorrect? I reverted that PR in #13262 as it introduced another issue.

Perhaps this issue was fixed in another PR? Or, perhaps this issue is still open?

@locks
Copy link
Contributor

locks commented Feb 26, 2018

Oops, someone posted it on the triage channel. Reopening!

@locks locks reopened this Feb 26, 2018
@anpenava
Copy link

anpenava commented Jul 9, 2018

this issue still happening for me, I am using ember-cli version 2.18.2

@buschtoens
Copy link
Contributor

@anpenava the ember-cli version should be irrelevant here. What is your Ember.js (ember-source) version? :)

@anpenava
Copy link

anpenava commented Jul 9, 2018

@buschtoens "ember-source": "~2.18.0"

@pixelhandler
Copy link
Contributor

This appears to still be an issue I updated the ember-twiddle example, https://ember-twiddle.com/5e91f27f1df42b6e41231f53a12af3da?openFiles=application.controller.js%2C

@joegaudet
Copy link

A possibly related issue, I've noticed that if some of the details on a link change, like say the query parameters, while the link is being transitioned into it causes the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants