Router history creating duplicate entries

Hi All,

Application is a SPA using a custom router. For the route /search/ an instance of instantsearch is created that uses instantsearch.routers.history.

The user selects a search result and our custom router renders /search/category/result

From /search/category/result the user may go on to visit more URLs that will be rendered by our router. This ultimately breaks history since instantsearch.routers.history keeps pushing states as the URLs change along with our router which creates duplicate entries.

I could destroy the instantsearch instance once the user navigates away from /search/ but I would much rather simply have instantsearch.routers.history do nothing for a subset of urls. Is this possible?

I’m assuming window.history.pushState is happening somewhere can I override this?