Skip to content

Commit fb0485e

Browse files
committed
fix: improve handling of VaporTransition components and enhance fallthrough props logic
1 parent 59425b0 commit fb0485e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

packages/runtime-vapor/src/component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ export function createComponent(
202202
if (
203203
(isSingleRoot ||
204204
// transition has attrs fallthrough
205-
(parentInstance &&
206-
getComponentName(parentInstance!.type) === 'VaporTransition')) &&
205+
(parentInstance && isVaporTransition(parentInstance!.type))) &&
207206
component.inheritAttrs !== false &&
208207
isVaporComponent(parentInstance) &&
209208
parentInstance.hasFallthrough
@@ -412,7 +411,7 @@ export function setupComponent(
412411
if (root) {
413412
renderEffect(() => {
414413
const attrs =
415-
isFunction(component) && component.displayName !== 'VaporTransition'
414+
isFunction(component) && !isVaporTransition(component)
416415
? getFunctionalFallthrough(instance.attrs)
417416
: instance.attrs
418417
if (attrs) applyFallthroughProps(root, attrs)
@@ -915,3 +914,7 @@ export function getRootElement(
915914
return hasComment ? singleRoot : undefined
916915
}
917916
}
917+
918+
function isVaporTransition(component: VaporComponent): boolean {
919+
return getComponentName(component) === 'VaporTransition'
920+
}

packages/runtime-vapor/src/components/Transition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const decorate = (t: typeof VaporTransition) => {
4444
}
4545

4646
export const VaporTransition: FunctionalVaporComponent = /*@__PURE__*/ decorate(
47-
(props, { slots, attrs }) => {
47+
(props, { slots }) => {
4848
// wrapped <transition appear>
4949
let resetDisplay: Function | undefined
5050
if (

packages/runtime-vapor/src/fragment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export class DynamicFragment extends VaporFragment {
190190
}
191191

192192
// switch current instance to parent instance during update
193+
// ensure that the parent instance is correct for nested components
193194
let prev
194195
if (this.parentComponent && parent)
195196
prev = setCurrentInstance(this.parentComponent)
@@ -207,7 +208,7 @@ export class DynamicFragment extends VaporFragment {
207208
}
208209

209210
if (parent) {
210-
// fallthrough attrs
211+
// apply fallthrough props during update
211212
if (this.attrs) {
212213
if (this.nodes instanceof Element) {
213214
renderEffect(() =>

0 commit comments

Comments
 (0)