Page MenuHomePhabricator

Browser back button behavior broken by pager URL state change
Closed, ResolvedPublic

Description

  • view details of tool
  • view history for that tool
  • use back to return to tool detail view
  • notice that "?page=1" gets inserted in the url
  • notice that back button no longer changes page in meaningful way
    • it actually does go "back" to the url without "?page=1", but that is immediately un-done by some state trigger we have setup

Event Timeline

I think this might be related to the window.onpopstate handler installed in vue/src/views/Home.vue, but that is just a hunch at this point.

I think this might be related to the window.onpopstate handler installed in vue/src/views/Home.vue, but that is just a hunch at this point.

Add a console.log( 'window.onpopstate from Home' ); statement confirms that this handler is at least part of the problem. This handler is global and not scoped to the active route at time of install. We probably actually want a watch on $route.query.page scoped to Home.vue rather than a global handler.

Change 678433 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[wikimedia/toolhub@main] ui: Update Home.vue back button handling

https://gerrit.wikimedia.org/r/678433

Change 678433 merged by jenkins-bot:

[wikimedia/toolhub@main] ui: Update Home.vue back button handling

https://gerrit.wikimedia.org/r/678433