fix(runtime-vapor): avoid exposing built-in components internals via template ref#14448
fix(runtime-vapor): avoid exposing built-in components internals via template ref#14448edison1105 merged 5 commits 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 Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
c06bead to
5773f64
Compare
@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
|
8eb545b to
7ec845a
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
packages/runtime-vapor/src/components/TransitionGroup.ts (1)
60-62: Same typing suppression pattern as inTransition.ts.This is the same
@ts-expect-error/expose()context-typing gap already flagged; please address both callsites via the shared typing fix.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/runtime-vapor/src/components/TransitionGroup.ts` around lines 60 - 62, The // `@ts-expect-error` on the setup call is hiding an untyped context; fix it by typing the setup context instead of suppressing errors: import SetupContext from 'vue' (or use the correct SetupContext generic) and change the signature to setup(props: TransitionGroupProps, { slots, expose }: SetupContext) (and call expose() as before), removing the comment; apply the same shared typing fix to the matching setup in Transition.ts so both callsites use the correctly typed SetupContext.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/runtime-vapor/src/components/KeepAlive.ts`:
- Line 153: Do not reset keepAliveInstance.exposed to null during HMR; remove
the assignment (or restore the previous exposed value) so the exposed reference
remains intact across rerenders—locate the line that sets
keepAliveInstance.exposed = null in KeepAlive.ts and either delete that
statement or replace it with logic that preserves the existing exposed value
instead of assigning null.
In `@packages/runtime-vapor/src/components/Transition.ts`:
- Around line 91-94: The expose() calls in Transition and TransitionGroup are
violating the FunctionalVaporComponent signature because expose is defined as
expose: <T extends Record<string, any> = Exposed>(exposed: T) => void but the
components call expose() with no arg; fix by making the parameter optional on
the FunctionalVaporComponent signature (change to expose: <T extends
Record<string, any> = Exposed>(exposed?: T) => void) so callers like Transition
and TransitionGroup can call expose() without error, or alternatively update the
callers (Transition and TransitionGroup) to call expose({}) instead; update the
signature in the component type (FunctionalVaporComponent / component.ts) if you
want a systemic fix, or change the two expose() calls in Transition and
TransitionGroup to expose({}) if you prefer a localized change.
---
Duplicate comments:
In `@packages/runtime-vapor/src/components/TransitionGroup.ts`:
- Around line 60-62: The // `@ts-expect-error` on the setup call is hiding an
untyped context; fix it by typing the setup context instead of suppressing
errors: import SetupContext from 'vue' (or use the correct SetupContext generic)
and change the signature to setup(props: TransitionGroupProps, { slots, expose
}: SetupContext) (and call expose() as before), removing the comment; apply the
same shared typing fix to the matching setup in Transition.ts so both callsites
use the correctly typed SetupContext.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
package.jsonpackages-private/vapor-e2e-test/transition/App.vuepackages/runtime-vapor/src/apiTemplateRef.tspackages/runtime-vapor/src/components/KeepAlive.tspackages/runtime-vapor/src/components/Transition.tspackages/runtime-vapor/src/components/TransitionGroup.ts
Summary by CodeRabbit