Skip to content
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

Fix generating html with script tags to ensure correct order #1403

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

smalluban
Copy link
Collaborator

@smalluban smalluban commented Nov 30, 2023

Fixes #1400.

The root cause of the issue is the order execution of script tags when the panel is open for the very first time. After the initial load, all of the scripts are cached in memory, so the next load execution order is correct.

The PR adds a fix on the vite source code level, as this cannot be set by the Vite configuration. We are using Vite in very specific way, where we do not bundle modules into a single file, so Vite interprets html entries, as having only one import. It tries to resolve it to the list of nested imports, but it goes deep in the tree. As a result, a long list of scripts are loaded by the script tag. It looks like Safari when loading for the first time does not respect the order of async scripts.

The fix is safe, as we can load only the top level of imports - they import other files just from the import statements in the source code.

@smalluban smalluban requested a review from chrmod November 30, 2023 11:11
@smalluban smalluban merged commit 7db1b88 into main Dec 4, 2023
2 checks passed
@smalluban smalluban deleted the v10-fix-safari-adoptedstylesheets branch December 4, 2023 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ghostery panel is empty after a new installation
2 participants