From e5d1d29b1d850092953393286374284eb07e187a Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 12 Apr 2023 18:10:18 +0100 Subject: [PATCH] fix(nuxt): add missing imports to `` (#20237) --- ...ent-fallback.client.mjs => client-fallback.client.ts} | 3 ++- ...ent-fallback.server.mjs => client-fallback.server.ts} | 9 +++++---- .../src/app/components/{dev-only.mjs => dev-only.ts} | 0 3 files changed, 7 insertions(+), 5 deletions(-) rename packages/nuxt/src/app/components/{client-fallback.client.mjs => client-fallback.client.ts} (89%) rename packages/nuxt/src/app/components/{client-fallback.server.mjs => client-fallback.server.ts} (85%) rename packages/nuxt/src/app/components/{dev-only.mjs => dev-only.ts} (100%) diff --git a/packages/nuxt/src/app/components/client-fallback.client.mjs b/packages/nuxt/src/app/components/client-fallback.client.ts similarity index 89% rename from packages/nuxt/src/app/components/client-fallback.client.mjs rename to packages/nuxt/src/app/components/client-fallback.client.ts index 19c378daff..94605f7c01 100644 --- a/packages/nuxt/src/app/components/client-fallback.client.mjs +++ b/packages/nuxt/src/app/components/client-fallback.client.ts @@ -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', diff --git a/packages/nuxt/src/app/components/client-fallback.server.mjs b/packages/nuxt/src/app/components/client-fallback.server.ts similarity index 85% rename from packages/nuxt/src/app/components/client-fallback.server.mjs rename to packages/nuxt/src/app/components/client-fallback.server.ts index 547487d6be..14bde96f40 100644 --- a/packages/nuxt/src/app/components/client-fallback.server.mjs +++ b/packages/nuxt/src/app/components/client-fallback.server.ts @@ -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) { diff --git a/packages/nuxt/src/app/components/dev-only.mjs b/packages/nuxt/src/app/components/dev-only.ts similarity index 100% rename from packages/nuxt/src/app/components/dev-only.mjs rename to packages/nuxt/src/app/components/dev-only.ts