fix(hmr): suppress provide warning during HMR updates for mounted instances#14195
fix(hmr): suppress provide warning during HMR updates for mounted instances#14195edison1105 merged 1 commit intominorfrom
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.
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: |
b3cde3f to
eadd8b2
Compare
No description provided.