diff --git a/src/runtime-utils/mount.ts b/src/runtime-utils/mount.ts index 128bd338a..87d5d4626 100644 --- a/src/runtime-utils/mount.ts +++ b/src/runtime-utils/mount.ts @@ -104,26 +104,20 @@ export async function mountSuspended( 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) => - wrappedSetup(props, setupContext) - : undefined, + setup: setup ? (props: Record) => wrappedSetup(props, setupContext) : undefined, } - return () => - h(clonedComponent, { ...props, ...attrs }, slots) + return () => h(clonedComponent, { ...props, ...attrs }, slots) }, }), }