I am trying to sync some page state to the URL's search params using a combination of window.history.replaceState and the query-string package for serialization and deserialization.
However I'm finding that this only seems to partially work and messing around with the history stack seems to break a lot of navigation - back/forward events seem to break completely and the state of the url and the application go out of sync. You have to go "back" repeatedly until the view changes. I suspect that by trying to interact with the history stack directly I'm breaking something internal to next.
Does anyone have some kosher recommendations for syncing state to search params that don't seem to break nextjs routing?