-
-
Notifications
You must be signed in to change notification settings - Fork 9k
fix(hmr): suppress provide warning during HMR updates for mounted instances #14195
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
base: minor
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Size ReportBundles
Usages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a false positive warning that occurs when provide() is called during HMR (Hot Module Replacement) updates on already-mounted component instances. The warning "provide() can only be used inside setup()" was incorrectly triggered during legitimate HMR reloads, particularly in components like router-view that call setup during re-renders.
- Adds HMR context check to suppress provide() warning during hot updates
- Includes test coverage for the router-view-like scenario where setup is re-executed on HMR reload
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/runtime-core/src/apiInject.ts | Adds isHmrUpdating check to the provide() validation to suppress warnings during HMR updates for mounted instances |
| packages/runtime-vapor/tests/hmr.spec.ts | Adds test case that simulates a router-view component scenario and verifies the warning is not shown during HMR reload |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
No description provided.