Closed nobitagit closed 1 year ago
It's indeed complicated to keep the state correctly in sync, and depending on your use case, that code will not be needed, but it's required for the flow:
That is because pop state is triggered for "regular" navigations, ones that don't use pushState
It's indeed true the example probably could be simplified though, although it's a very fragile part of the platform IMO
Thanks again for this concern. The main point is not reading from history.state. That's indeed correct and the change was made in InstantSearch.js in https://github.com/algolia/instantsearch.js/pull/5177. I also made a PR to the documentation that will close this issue when merged to transform those snippets to always read from the URL without trusting history.state
Bug π
Hello. This is not really a bug, but a possible mistake in the docs. Let me know if I am missing something.
What is the current behavior?
If you check the docs for the routing > Combining with Vue Router these lines appear in the example:
It looks to me these lines are not needed and actually break the browser back/forward button.
Make a sandbox with the current behavior
Take this sandbox.
What is the expected behavior?
Take this other sandbox where I commented out the lines I posted at the beginning of this issue.
Does this happen only in specific situations?
.
What is the proposed solution?
Delete the lines from the docs, if they are not needed. Otherwise I'd be curious to know which corner case these lines are there for, so I avoid introducing bugs in my own app.
Many thanks, have a nice weekend.
What is the version you are using?