Skip to content

Commit

Permalink
fix: avoid enumerating keys on render context
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Dec 6, 2023
1 parent dc93e00 commit 43b2724
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/runtime-utils/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,20 @@ export async function mountSuspended<T>(
name: 'MountSuspendedComponent',
...component,
render: render
? (_ctx: any, ...args: any[]) => {
// add all _ctx properties to renderContext
// the renderContext must remain intact, otherwise the emits don't work
for (const key in _ctx) {
? function (this: any, _ctx: any, ...args: any[]) {
for (const key in props || {}) {
renderContext[key] = _ctx[key]
}
return render.apply(_ctx, [
renderContext,
...args,
])
for (const key in setupState || {}) {
renderContext[key] = setupState[key]
}
return render.call(this, renderContext, ...args)
}
: undefined,
setup: setup
? (props: Record<string, any>) =>
wrappedSetup(props, setupContext)
: undefined,
setup: setup ? (props: Record<string, any>) => wrappedSetup(props, setupContext) : undefined,
}

return () =>
h(clonedComponent, { ...props, ...attrs }, slots)
return () => h(clonedComponent, { ...props, ...attrs }, slots)
},
}),
}
Expand Down

0 comments on commit 43b2724

Please sign in to comment.