Ember.js: transition.abort() does not work for query param only transitions

Created on 22 Nov 2019  Â·  6Comments  Â·  Source: emberjs/ember.js

When calling transition.abort() on a transition which only changes the query params, the transition goes ahead anyway. I am using the ‘routeWillChange’ event in the router service to intercept the transition. transition.abort() is called but does not prevent the params change.

Perhaps a slightly different issue, but transition.abort() also triggers the ‘routeWIllChange’ event again, with some confusing properties. ‘isAborted’ is true, ‘isCausedByAbortingTransition’ is false, and the ‘to’ and ‘from’ objects both point to the original ‘from’ query params, not the new query params. If nothing else, surely an aborted transition shouldn’t be triggering the ‘routeWillChange’ event?

Has Reproduction Router Bugs

Most helpful comment

thanks @normanhaze / @omairvaiyani, updated

All 6 comments

I'm seeing a similar issue. Didn't noticed this one exists before I had written it down. Maybe my long explanation will be helpful.

Edit: Think mine is slightly different and related to many other issues. Opened it as a separate issue: #18577

@normanhaze what version of Ember are you seeing this in? And are you able to send in a reproduction to make it easier to track this down?

Hi @acorncom - I'm using 3.13, but I've created a demo app using 3.15 and the issue is still there. Take a look: https://github.com/normanhaze/transition-issue-demo

A 'routeWillChange' event is set in the component's constructor, which triggers when the queryParams change (when you click the button).

The first transition has the correct 'from' and 'to' query params, and appears to be aborted, and the event triggers again with a new transition. The 'from' and 'to' query params are both for the current route. This is not aborted due to the check for the 'isAborted' property. However, the query params change to the original target anyway.

Hi guys, this issue should have Needs reproduction label removed as it is reproducable using that repo posted by @normanhaze

thanks @normanhaze / @omairvaiyani, updated

Was this page helpful?
0 / 5 - 0 ratings