fix(nuxt): add missing imports to <NuxtClientFallback> (#20237)

This commit is contained in:
Daniel Roe 2023-04-12 18:10:18 +01:00 committed by GitHub
parent 22f1f71e3e
commit e5d1d29b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import { createElementBlock, defineComponent } from 'vue'
import { createElementBlock, defineComponent, onMounted, ref } from 'vue'
import { useState } from '../composables/state'
export default defineComponent({
name: 'NuxtClientFallback',

View File

@ -1,5 +1,6 @@
import { defineComponent, getCurrentInstance, onErrorCaptured } from 'vue'
import { defineComponent, getCurrentInstance, onErrorCaptured, ref } from 'vue'
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderVNode } from 'vue/server-renderer'
import { useState } from '../composables/state'
import { createBuffer } from './utils'
const NuxtClientFallbackServer = defineComponent({
@ -40,8 +41,8 @@ const NuxtClientFallbackServer = defineComponent({
const defaultSlot = ctx.slots.default?.()
const ssrVNodes = createBuffer()
for (let i = 0; i < defaultSlot.length; i++) {
ssrRenderVNode(ssrVNodes.push, defaultSlot[i], vm)
for (let i = 0; i < (defaultSlot?.length || 0); i++) {
ssrRenderVNode(ssrVNodes.push, defaultSlot![i], vm!)
}
return { ssrFailed, ssrVNodes }
@ -52,7 +53,7 @@ const NuxtClientFallbackServer = defineComponent({
return { ssrFailed: true, ssrVNodes: [] }
}
},
ssrRender (ctx, push, parent) {
ssrRender (ctx: any, push: any, parent: any) {
if (ctx.ssrFailed) {
const { fallback, placeholder } = ctx.$slots
if (fallback || placeholder) {