So this ONLY happens in EDIT mode ? Then there is good news and bad news
Bad news is that edit mode is different from the others in the way that we don’t do hydration there to disable client-side interactivity. This is needed to make sure CS page editor does not interfere with client code and probably is the reason why your router is not initialized.
Good news is that you can still have some components hydrated !
This is done with react component <StaticContent>. Everything inside it is not hydrated, while everything outside is.
Content studio augments the page in page editor so the page needs to stay static.
Any kind of problems on UI as well as data corruption on save may happen if page changes its html.
As long as you don’t change page html, something like this should do the trick:
I think that would become unnecessary complex as MyCustomClientHooksComponent is a fully integrated PartComponent .
I decided to render a dummy-component with limited functionality - as I need no Routing in EDIT Mode. And thanks to React modularity this is not really much effort