Skip to content

Conversation

@danielroe
Copy link
Member

@danielroe danielroe commented Nov 6, 2025

🔗 Linked issue

resolves #33644
resolves #33080

📚 Description

we were registering some event listeners in #32918.

this cleans them up in either app:error or app:rendered

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 6, 2025

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@33665

nuxt

npm i https://pkg.pr.new/nuxt@33665

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@33665

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@33665

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@33665

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@33665

commit: aec207d

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Walkthrough

The mergeAbortSignals function in the asyncData composable has been refactored to accept a NuxtApp parameter as its first argument. All existing call sites have been updated to pass this parameter. A new helper function, removeListenerAfterRender, has been introduced to manage abort listener cleanup on the server side via hooks for app rendering completion or error states. The abort handling logic now uses a dedicated callback mechanism and ensures proper cleanup of abort listeners post-render.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10–15 minutes

  • Verify that all call sites to mergeAbortSignals throughout the file have been consistently updated with the nuxtApp parameter
  • Confirm the removeListenerAfterRender helper correctly registers and fires cleanup on both 'app:rendered' and 'app:error' hooks
  • Check for potential race conditions between listener registration and removal during server rendering
  • Ensure the abort callback wiring integrates correctly with the existing signal merging logic

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing abort signal event listeners after render, which directly addresses the memory leak issue.
Linked Issues check ✅ Passed The PR directly addresses the memory leak [#33644] by implementing cleanup of abort signal event listeners after render, which aligns with the identified root cause.
Out of Scope Changes check ✅ Passed All changes are scoped to abort signal listener management in asyncData.ts and directly target the memory leak issue without introducing unrelated modifications.
Description check ✅ Passed The pull request description clearly relates to the changeset by explaining that it cleans up event listeners registered in a previous PR, addressing the memory leak issue.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/remove-listeners

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 6, 2025

CodSpeed Performance Report

Merging #33665 will not alter performance

Comparing fix/remove-listeners (aec207d) with main (0014826)1

Summary

✅ 10 untouched

Footnotes

  1. No successful run was found on main (dbea282) during the generation of this report, so 0014826 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@danielroe danielroe merged commit 3e1eb66 into main Nov 6, 2025
58 checks passed
@danielroe danielroe deleted the fix/remove-listeners branch November 6, 2025 10:33
This was referenced Nov 6, 2025
@github-actions github-actions bot mentioned this pull request Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak in Nuxt 4.2.0 EffectScope memory leak in Nuxt 4, when Vue setup blocks have await calls in them

2 participants