-
-
Notifications
You must be signed in to change notification settings - Fork 9k
fix(slot): enhance v-slot prop destructuring support #14165
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
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 |
@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: |
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 enhances v-slot prop destructuring support by refactoring the destructuring logic to be shared between v-for and v-slot implementations. The key improvement is that slot props now use proper accessor paths (dot notation for simple properties, computed access for dynamic keys) instead of always using bracket notation.
- Extracts
parseValueDestructureandbuildDestructureIdMapfunctions from v-for implementation to make them reusable - Updates v-slot handling to use the shared destructuring logic, enabling support for nested destructuring, computed keys, rest elements, and default values
- Changes generated code from bracket notation (
_slotProps0["foo"]) to dot notation (_slotProps0.foo) for cleaner output
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/compiler-vapor/src/generators/for.ts | Extracts parseValueDestructure and buildDestructureIdMap as exported functions to enable reuse; refactors the v-for implementation to use the new functions |
| packages/compiler-vapor/src/generators/component.ts | Updates slot prop handling to use the shared destructuring functions, removing the simpler bracket-notation-only logic and enabling full destructuring support |
| packages/compiler-vapor/tests/transforms/vSlot.spec.ts | Adds comprehensive test cases for alias, nested, computed key, rest, and default value destructuring; updates existing test expectations to use dot notation |
| packages/compiler-vapor/tests/transforms/snapshots/vSlot.spec.ts.snap | Updates all snapshots to reflect the new dot notation output and adds snapshots for new test cases |
| packages/compiler-vapor/tests/snapshots/scopeId.spec.ts.snap | Updates snapshot to use dot notation for slot prop access |
| packages/compiler-vapor/tests/snapshots/compile.spec.ts.snap | Updates snapshot to use dot notation for slot prop access |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.