Skip to content

Commit

Permalink
fix(preview): prerendering issue on load
Browse files Browse the repository at this point in the history
  • Loading branch information
larbish committed Nov 27, 2024
1 parent 66cd372 commit b955f76
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/plugins/studio/preview.client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PublicRuntimeConfig } from '@nuxt/content'
import { defineNuxtPlugin, useCookie, useRoute, useRuntimeConfig } from '#imports'
import { defineNuxtPlugin, useCookie, useRoute, useRuntimeConfig, getAppManifest } from '#imports'

export default defineNuxtPlugin(async (nuxtApp) => {
const studioConfig: PublicRuntimeConfig['studio'] = useRuntimeConfig().public.studio || {}
Expand All @@ -23,6 +23,10 @@ export default defineNuxtPlugin(async (nuxtApp) => {
window.sessionStorage.setItem('previewToken', String(previewToken.value))
window.sessionStorage.setItem('previewAPI', typeof route.query.staging !== 'undefined' ? 'https://dev-api.nuxt.studio' : studioConfig.apiURL)

const manifest = await getAppManifest()
// Disable prerendering for preview
manifest.prerendered = []

nuxtApp.hook('app:mounted', async () => {
await import('../../internal/studio').then(({ mountPreviewUI, initIframeCommunication }) => {
mountPreviewUI()
Expand Down

0 comments on commit b955f76

Please sign in to comment.