-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Describe the bug
I have paged tru the @nuxtjs/sanity documentation and a few examples but Visual Editing in Nuxt isn't up and running for me yet. The in-browser warning is:
[@sanity/comlink] Received no response to message 'comlink/heartbeat' on client 'presentation' (ID: 'longIdHere').
But when searching for examples on how Visual editing needs to be assembled, I found the @sanity-io/visual-editing/apps/nuxt repo uses a <VisualEditing/> component on a /preview route that is not mentioned in any other documentation, when used in Nuxt via the @nuxtjs/sanity package, it warns that the component does not exist. Should this be mentioned in the docs somewhere?
<template>
<main>
<nav
class="sticky top-0 flex items-center gap-1 border-b border-gray-300 bg-white p-2 text-gray-600"
>
<div class="p-2 text-sm leading-none">Router:</div>
<NuxtLink
class="rounded p-2 leading-none hover:bg-gray-200"
exact-active-class="bg-gray-200"
to="/preview"
>Parent</NuxtLink
>
<NuxtLink
class="rounded p-2 leading-none hover:bg-gray-200"
exact-active-class="bg-gray-200"
to="/preview/child"
>Child</NuxtLink
>
<div class="border-l p-2 pl-2 text-sm leading-none">Browser:</div>
<a
:class="{'bg-gray-200': route.path === '/preview'}"
class="rounded p-2 leading-none hover:bg-gray-200"
href="/preview"
>Parent</a
>
<a
:class="{'bg-gray-200': route.path === '/preview/child'}"
class="rounded p-2 leading-none hover:bg-gray-200"
href="/preview/child"
>Child</a
>
</nav>
<ClientOnly>
<VisualEditing>
<NuxtPage />
</VisualEditing>
</ClientOnly>
</main>
</template>
<script setup lang="ts">
import {enableVisualEditing, type DisableVisualEditing} from '@sanity/visual-editing'
let disable: DisableVisualEditing
onMounted(() => {
disable = enableVisualEditing()
})
onUnmounted(() => disable())
const route = useRoute()
</script>
Expected behavior
If the component is actively needed for Visual Editing to work, it should be documented
Which versions of Sanity are you using?
@sanity/client: 6.28.0
@sanity/cli (global) 3.8.1 (latest: 3.81.0)
@sanity/code-input 4.1.4 (latest: 5.1.2)
@sanity/eslint-config-studio 3.0.1 (latest: 5.0.2)
@sanity/form-builder 2.36.2 (up to date)
@sanity/orderable-document-list 1.3.2 (up to date)
@sanity/schema 3.81.0 (up to date)
@sanity/studio-secrets 3.0.1 (up to date)
@sanity/table 1.1.3 (up to date)
@sanity/ui 2.15.8 (latest: 2.15.10)
@sanity/util 3.81.0 (up to date)
@sanity/uuid 3.0.2 (up to date)
@sanity/vision 3.81.0 (up to date)
sanity 3.81.0 (up to date)
@nuxtjs/sanity: 1.13.3
OS: Mac OS 15.3.2, Arc Browser
Node: 18, 20 also tried