@Myrdhin wrote:
Hello everybody Image may be NSFW.
Clik here to view.I noticed a strange behavior in Ember … I’m trying to cancel a transition in the
willTransition
hook. For example, I’m on “page2” and I’m from “page1”. When I click on the link “page1”, no problem: the transition is canceled and the url doesn’t change. On the other hand, when I use the back button of the browser, the url changes first (I see the url of page1 in the bar) then the transition is canceled. The problem: I’m still on page2 but I now have the url of page1 !!! Is this a bug?My route2.js code to simulate this behavior (here I use confirm but in my prod code I use bootbox):
import Route from '@ember/routing/route'; export default Route.extend({ actions: { willTransition(transition) { if (!transition.data.force) { transition.abort(); const r = confirm("Do you want to cancel transition?"); if (r === false) { transition.data.force = true; transition.retry(); } } } } });
Thanks for your help,
Posts: 1
Participants: 1