kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 195 forks source link

OPTIONALLY better handling of routing when stop is called from a trigger (stop() generates current behaviour; stop(true) generates the new behaviour) #681

Open convexset opened 7 years ago

convexset commented 7 years ago

OPTIONALLY better handling of routing when stop is called from a trigger (both triggersEnter and triggersExit). Original behaviour of FlowRouter is preserved.

Addresses issues like: https://github.com/kadirahq/flow-router/issues/491

stop has to be called with one argument (with value true; defaults to false, which generates the original behaviour)

With this tweak, triggersExit fires again after another exit attempt.

Using stop(true) in triggersExit results in a duplicate entry in the user's history will be created in the "next" slot. This is arguably a small price to pay for triggersExit firing again (on routing) after a stop.

Using stop(true) in triggersEnter results in a new entry in the user's history in the "next" slot for the route for which entry was stopped.