Lots of pages on my site have their own javascript files that are included in their respective pages.
SmoothState provides the onAfter handler to re-initialize plugins, and some of these pages' javascript files have their own "init function" that initializes whatever plugins they are using. So obviously, the goal would be to invoke these initialization functions in the onAfter handler.
It appears however that SmoothState is keeping each pages javascript file loaded. What this results in, is that some of these scripts have functions of the same name (but obviously different function) and this is causing some of them to be "replaced."
For example, the init function is never invoked correctly because the last loaded page overrides it.
I toyed around with this a bit.
You need to place the
<script>tags that are unique per page inside the container you provide to smoothstate during its initialization. I.e, inside the "main" div. Maybe this is in the documentation somewhere, but I did not see it.Everything outside of the main div will not be reloaded.