-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toolbar script loads external assets for all users #43
Comments
I'm also slightly concerned because the bootstrap file that is loaded isn't part of this repository (is it open source - I couldn't find it on github?) and it then goes on to load jQuery from a CDN. From the minified source, I couldn't see much justification for jQuery's presence - a call to .ajax and .deferred. Maybe those could be replaced with modern equivalents of fetch and promise then the dependency could be removed entirely? |
I'm having the same issue. This affects the Lighthouse performance score for the page because the request to The toolbar and its related files should only be loaded for users who are logged in and/or using the Preview or Edit features, not all users. I also agree that the jQuery dependency should be removed and replaced with more modern JS. For the time being, I've worked around the performance issue by making the call to
|
Hi! Any update on this? Maybe we could load a really small script first to check if user is logged on a prismic session (basically just a cookie check), and from there decide whether to load all the logic to handle previews / edit buttons? |
Using the defer attribute helps mitigate the problem, but it's not a solution in itself. We definitely should avoid loading external ressources on clients that don't need them at all, even if it doesn't block the loading of critical ressources. For now we can probably do the cookie detection ourselves and append the script dynamically in the body (haven't tested this yet though), but it'd be nice if this was implemented directly in the toolbar script :) |
Push! Since it really is blocking us from using Prismic in our next projects. |
Loving Prismic, but when including the Toolbar script on a website, it would be great if the iframe and its external dependencies (bootstrap, jQuery) were only loaded when required for the current user.
I have a React/NextJS build and it looks like the iframe is injected and jQuery is loaded for every user even when not visible. It would be great if the Toolbar script could detect the cases where the user is logged in to Prismic or in a preview mode, A/B test, and inject only when needed/visible.
Would save about 30kb from what I can see.
Thanks
The text was updated successfully, but these errors were encountered: