Skip to content

⚡ Bolt: optimize PageTransition event listeners to prevent memory leaks#1137

Merged
github-actions[bot] merged 1 commit intomasterfrom
bolt/optimize-page-transition-listeners-3919580246294493363
Mar 26, 2026
Merged

⚡ Bolt: optimize PageTransition event listeners to prevent memory leaks#1137
github-actions[bot] merged 1 commit intomasterfrom
bolt/optimize-page-transition-listeners-3919580246294493363

Conversation

@kuasar-mknd
Copy link
Copy Markdown
Owner

💡 What: Refactored PageTransition.astro to use the Singleton Listener pattern for astro:before-preparation, astro:after-preparation, and document click events.
🎯 Why: Astro View Transitions can re-evaluate component scripts during navigation, causing anonymous event listeners to stack and execute redundantly, leading to memory leaks and performance degradation on the client side.
📊 Impact: Eliminates unbounded growth of global event listeners, preventing redundant main-thread executions and memory leaks on repeated page navigations.
🔬 Measurement: Verified locally using Playwright; the number of active event listeners on document and window no longer increases linearly with each page transition, maintaining a stable baseline memory footprint.


PR created automatically by Jules for task 3919580246294493363 started by @kuasar-mknd

Refactored `PageTransition.astro` to use the Singleton Listener pattern
for `astro:before-preparation`, `astro:after-preparation`, and `click` events.
This prevents unbounded memory leaks and redundant main-thread work caused
by script re-evaluations during Astro View Transitions.
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions bot enabled auto-merge (squash) March 26, 2026 17:30
@github-actions github-actions bot merged commit 762b963 into master Mar 26, 2026
7 checks passed
@github-actions github-actions bot deleted the bolt/optimize-page-transition-listeners-3919580246294493363 branch March 26, 2026 17:36
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.

1 participant