You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When merging new head scripts in to the head these are currently done asynchronously (as it's not possible to do synchronously). To my mind though, this breaks the way that html page loading is done in the browser. If, in a vanilla request, I add a script (without async and defer attributes) it is loaded before the rest of the page is rendered so that it is then available to the rest of the page. In turbo though, any scripts in the body are usually executed before those scripts have been loaded.
Various workarounds seem to be:
turn off turbo for those pages
bundle your JS and load on every page
manual pausing
I really feel like a generic solution (maybe opt-in) is possible here that will wait for the script elements to be loaded script.addEventHandler('load', ...) before resuming the render.
Would it be as simple as making the mergeHead method in the SnapshotRenderer of the async?
If that were not possible, a nice addition to the pausable api would be the provision of the new scripts alongside the new body so that users could wait for their scripts manually when necessary.
The text was updated successfully, but these errors were encountered:
Hi,
Sort of related to #28 ...
When merging new head scripts in to the head these are currently done asynchronously (as it's not possible to do synchronously). To my mind though, this breaks the way that html page loading is done in the browser. If, in a vanilla request, I add a script (without async and defer attributes) it is loaded before the rest of the page is rendered so that it is then available to the rest of the page. In turbo though, any scripts in the body are usually executed before those scripts have been loaded.
Various workarounds seem to be:
I really feel like a generic solution (maybe opt-in) is possible here that will wait for the script elements to be loaded
script.addEventHandler('load', ...)
before resuming the render.Would it be as simple as making the
mergeHead
method in theSnapshotRenderer
of the async?If that were not possible, a nice addition to the pausable api would be the provision of the new scripts alongside the new body so that users could wait for their scripts manually when necessary.
The text was updated successfully, but these errors were encountered: