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

Transitioning CSS class on multiple links to same route #12419

Closed
topaxi opened this issue Oct 1, 2015 · 5 comments
Closed

Transitioning CSS class on multiple links to same route #12419

topaxi opened this issue Oct 1, 2015 · 5 comments
Labels

Comments

@topaxi
Copy link
Contributor

topaxi commented Oct 1, 2015

When linking to the same route, with a different model, all links add the ember-transitioning-in class.
On this one, I'm not sure if this is right or wrong.

But this seems definitely like a bug:
When the transition ends, none of links but the one clicked remove the ember-transitioning-in.

Small example: http://emberjs.jsbin.com/muwaxavive/edit?html,css,js,output

Click on any color to switch to a subroute, all links go immediately red (ember-transitioning-in), after the transition, the clicked color goes blue again but the other links stay red.

This might be related or even a duplicate of #10989 or #10195

@pixelhandler
Copy link
Contributor

@topaxi yeah this seems like a bug. The css class ember-transitioning-in seems sticky. Below is the HTML after clicking the links in order, red, yellow, blue. The class should be gone after the transition is done right?

<ul>
      <li><a id="ember324" href="#/red" class="ember-view ember-transitioning-in">red</a></li>
      <li><a id="ember338" href="#/yellow" class="ember-view ember-transitioning-in">yellow</a></li>
      <li><a id="ember339" href="#/blue" class="ember-view active">blue</a></li>
</ul>

@topaxi
Copy link
Contributor Author

topaxi commented Oct 3, 2015

@pixelhandler yes, the ember-transitioning-in should definitely be gone after the transition.

topaxi added a commit to topaxi/ember.js that referenced this issue Dec 22, 2015
@topaxi
Copy link
Contributor Author

topaxi commented Dec 22, 2015

I've added a failing test for this issue at master...topaxi:transitioning-in-dynamic-segment. After going through some ember routing modules and tildeio/router.js I'm unsure where the issue lies and in which repository this should be reported and fixed.

@locks locks added the Bug label Apr 20, 2016
@XaserAcheron
Copy link

Welp. I just ran straight into this -- same use case, basically. I've got a route which serves up some data-driven content, along with a navbar that transitions to the same route with a different model. ember-transitioning-in gets applied to every link-to. :(

I haven't been able to narrow it down properly (running into issues getting Ember's dev environment set up), but I suspect the culprit is somewhere around here. I suspect the willBeActive computed property is returning true for all the "incorrect" link-to's, and transitioningIn never gets recomputed once the transition completes since active is never set on these extra links, leaving the ember-transitioning-in class hanging in limbo.

I'll see if I can pry further. I'd better throw together a test app so I don't have to upgrade my working ember version to canary. :P

@bgentry
Copy link
Contributor

bgentry commented Oct 30, 2017

This bug is definitely still active, I just encountered it on v2.16.0.

I have a route items.show with a dynamic ID segment. I'm using the link-to helper with the model ID instead of a whole model because I'm using ember-apollo-client and want a different set of data fetched for the child route. When I click between a list of items, every single one of them gets the .ember-transitioning-in class applied. It is only removed from the item that eventually gets transitioned to, while the class remains on every other link that points to the same route but with a different dynamic segment variable.

I traced this all the way down to isActiveIntent in router.js, which returns true in the case of these other links. Even more specifically, the problem occurs in this section.

At this point, contexts contains the dynamic segments of the not-actually-transitioning link. However, newState.handlerInfos, testState.handlerInfos both end up having handlers with identical params, specifically { id: "ID_OF_ITEM_ACTUALLY_BEING_VISITED" }. They are in fact equal here, though it seems that testState.handlerInfos is probably intended to have the params of the link being tested rather than the route being transitioned to.

On reading this, I believe the NamedTransitionIntent function call applyToHandlers() is intended apply the params in contexts to the testState. This does not happen, however, and the params remain identical to the newState's params. You can see the result in this debugger screenshot:

screen shot 2017-10-29 at 9 32 50 pm

I'm in pretty far over my head here and I'm not able to figure out what the fix is. Also having a hard time grasping router.js code without any documentation. Hopefully this is enough info to help somebody familiar fix it pretty quickly?

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

No branches or pull requests

5 participants