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

astro:page-load broken and inconsistent, breaks scripts #12858

Open
1 task
cabaucom376 opened this issue Dec 30, 2024 · 2 comments
Open
1 task

astro:page-load broken and inconsistent, breaks scripts #12858

cabaucom376 opened this issue Dec 30, 2024 · 2 comments
Labels
needs triage Issue needs to be triaged

Comments

@cabaucom376
Copy link

cabaucom376 commented Dec 30, 2024

Astro Info

Astro                    v5.1.1
Node                     v23.5.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/node
Integrations             astro-meta-tags

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Initially, I could only get this to reproduce on Safari as it happens almost every time (especially iOS), but inconsistently, Chrome also has the bug. Sometimes when navigating to a page for the first time, astro:page-load is not triggered. After refreshing the page or navigating away and back, it triggers twice.

Utilizing the browser’s navigation controls instead of links seems to cause this more consistently. Whenever on a page with an astro:page-load script and you utilize browser controls to go back to a previous page, it will fire off the same script again, causing unintended side effects, especially if using event listeners.

What's the expected result?

astro:page-load only triggers once and is consistent. Utilizing browser navigation controls should not interfere as well.

Link to Minimal Reproducible Example

example

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 30, 2024
@martrapp martrapp added the needs repro Issue needs a reproduction label Dec 30, 2024
Copy link
Contributor

Hello @cabaucom376. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Dec 30, 2024
@cabaucom376
Copy link
Author

@martrapp Added an example. I don't seem to see any logic working on stackblitz but the code works locally. To reproduce:

  1. navigate to test page using link
  2. navigate back to home, triggering a re-execution
  3. navigate back to test page

@ematipico ematipico added needs triage Issue needs to be triaged and removed needs repro Issue needs a reproduction labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants