kadirahq / flow-router

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

[Meteor 1.6] Cannot navigate back to app homepage using browser back button #729

Closed derwaldgeist closed 6 years ago

derwaldgeist commented 6 years ago

After I upgraded my FlowRouter-based Meteor 1.5 app to 1.6, the browser back button doesn't work if the previous page is the initially loaded page of the app (i.e. the first page that was loaded when entering the page into the browser bar or reloading the app).

In this case, FlowRouter throws an error:

index.js:380 Uncaught TypeError: Cannot read property '0' of undefined
    at new Context (http://localhost:3030/packages/kadira_flow-router.js?hash=efa30c014ae98f03c2b46e0157cd8b8888078379:513:21)
    at Function.page.replace (http://localhost:3030/packages/kadira_flow-router.js?hash=efa30c014ae98f03c2b46e0157cd8b8888078379:404:15)
    at Function.self._page.(anonymous function) [as replace] (http://localhost:3030/packages/kadira_flow-router.js?hash=efa30c014ae98f03c2b46e0157cd8b8888078379:2241:16)
    at onpopstate (http://localhost:3030/packages/kadira_flow-router.js?hash=efa30c014ae98f03c2b46e0157cd8b8888078379:664:14)

The error is caused by this call: https://github.com/kadirahq/flow-router/blob/fb268d5ed3586b577faae27c3511ef84eaa7335d/client/router.js#L382 and actually pops up in the pages node module: https://github.com/visionmedia/page.js/blob/f241eafdc6b0a6545e27ad4dd82bcdeb305e7564/index.js#L380

Seems as if popping to the very top of the navigation stack doesn't work anymore.

If I downgrade my app to 1.5, it works again.

derwaldgeist commented 6 years ago

This problem is caused by okgrow:analytics: https://github.com/okgrow/analytics/issues/203