Skip to content

[codex] Clarify async watcher cleanup timing#3396

Open
Sean-Kenneth-Doherty wants to merge 1 commit into
vuejs:mainfrom
Sean-Kenneth-Doherty:codex/watcher-cleanup-async-docs
Open

[codex] Clarify async watcher cleanup timing#3396
Sean-Kenneth-Doherty wants to merge 1 commit into
vuejs:mainfrom
Sean-Kenneth-Doherty:codex/watcher-cleanup-async-docs

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown

Description of Problem

The watcher guide states that onWatcherCleanup() must be called synchronously, but the async callback case is easy to misread without a concrete before/after example.

Closes #3222.

Proposed Solution

Add examples showing that async watcher callbacks should register onWatcherCleanup() before the first await, and that calling it after an awaited operation is too late to register cleanup.

Additional Information

Validation:

  • pnpm install --frozen-lockfile
  • git diff --check
  • NODE_OPTIONS=--no-experimental-webstorage pnpm run build

Also ran pnpm run type; it fails on an existing .vitepress/config.ts plugin typing issue where a plugin tuple is cast to a single Plugin.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 3aeda0c
🔍 Latest deploy log https://app.netlify.com/projects/vuejs/deploys/6a095a51c9820100073c2c5c
😎 Deploy Preview https://deploy-preview-3396--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty marked this pull request as ready for review May 17, 2026 06:05
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.

Documentation clarification needed for onWatcherCleanup in async contexts

1 participant