Skip to content

Commit

Permalink
fix: test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede committed Oct 21, 2024
1 parent d20d133 commit 824cca3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/components/Motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@ export default defineComponent({
setup(props) {
const slots = useSlots()

const { motionConfig, setNodeInstance } = setupMotionComponent(props)
const attrs = useAttrs()
const { instances, motionConfig, setNodeInstance }
= setupMotionComponent(props)

return () => {
const attrs = useAttrs()
const style = variantToStyle(motionConfig.value.initial || {})
const node = h(props.is, attrs, slots)

const instance = setNodeInstance(node, 0, style)
setNodeInstance(node, 0, style)

// Wrap component in Transition if leave variant is set
if (props.leave) {
const wrapper = h(
Transition,
{
css: false,
onLeave: (_: any, done: any) => instance.leave(done),
onLeave: (_: any, done: any) => instances[0].leave(done),
},
() => [props.present && node],
)
Expand Down
3 changes: 2 additions & 1 deletion src/utils/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,11 @@ export function setupMotionComponent(
}
}

return instances[index]
return node
}

return {
instances,
motionConfig,
setNodeInstance,
}
Expand Down

0 comments on commit 824cca3

Please sign in to comment.