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

Ensure that all scripts are executed prior to astro:page-load #13380

Merged
merged 6 commits into from
Mar 11, 2025

Conversation

martrapp
Copy link
Member

@martrapp martrapp commented Mar 8, 2025

Changes

Fixes #12858

The original code to execute scripts after swap() made the assumption that all inline scripts
are directly executed when inserted into the DOM. This is not true for inline module scripts,
which are deferred but still executed in order.
Inline module scripts can not be awaited for with onload.
Thus to be able to wait for the execution of all scripts,
we make sure that the last inline module script
is always followed by an external module script.

Testing

new e2e test

Docs

n.a. / bugfix

Copy link

changeset-bot bot commented Mar 8, 2025

🦋 Changeset detected

Latest commit: e3067e4

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 8, 2025
@martrapp martrapp requested a review from matthewp March 8, 2025 11:30
Copy link

codspeed-hq bot commented Mar 8, 2025

CodSpeed Performance Report

Merging #13380 will not alter performance

Comparing mt/page-load (e3067e4) with main (725bc0d)

Summary

✅ 6 untouched benchmarks

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not very familiar with the code, but if the test passes, it should be good to merge!

@martrapp martrapp merged commit 9bfa6e6 into main Mar 11, 2025
16 checks passed
@martrapp martrapp deleted the mt/page-load branch March 11, 2025 14:26
@astrobot-houston astrobot-houston mentioned this pull request Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

astro:page-load broken and inconsistent, breaks scripts
2 participants