Closed pelid closed 4 years ago
@cognitom comment:
By the way, I think the content should be loaded after routing if you use frontend routing. In that point, I'm not sure your case is general or not.
In my case most of js files and riot templates packed in single js bundle. riot.route is launched after this bundle is loaded.
Anyway the problem is related with external async libraries (google analytics, hotjar, etc) included in the base html. So calling router before bundle is loaded will not solve the problem
@pelid the behaviour was introduced for fixing #33. https://github.com/riot/route/blob/v3.0.2/lib/index.js#L329-L334
@cognitom @pelid it seems a specific issue and not a route one. Riot-route allows you to start the router either automatically or via exec
. The autostart strategy waiting the window load is a common behavior used also by other famous html5 routing library i don't see any issue here.
Closing this issue because it's related to an old router version. Please update to the latest @riotjs/route
version if you can.
I have faced with strange behaviour of single page application built with riot.js . Its rendering was delayed until loading of all external js libraries finishes. It includes async externals, iframes content, etc. After investigation it became clear that
route.start(true)
calls appropriate route handler only after 'load' event browser trgiggers.It was not trivial to find the reason, a lot of time was spent. I suggest to describe this behaviour in documentation and suggest to explicitly call of
route.exec()
where it`s possible. My problem was solved as follows: