iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

onStop and unload hooks called twice? #1494

Open digz6666 opened 8 years ago

digz6666 commented 8 years ago

I have a simple controller as following, but onStop and unload hooks called twice when pressing back button.

Why it's running twice? Is there any way to prevent it from running multiple times? When I press on links it runs single time:

LoginController = RouteController.extend({
    onStop: function() { // page unload
        console.log('onStop');
    },

    unload: function() { // page unload
        console.log('unload');
        history.go(-1)
    }
});
chrisbutler commented 8 years ago

does it happen if you remove the history.go?

digz6666 commented 8 years ago

It is not happening when i remove history.go. Any other preferred solutions?

digz6666 commented 8 years ago

When I press on links to go to other page, then unload and onstop hook run once.