diff --git a/__tests__/e2e/data-loading/data.test.ts b/__tests__/e2e/data-loading/data.test.ts index fafc403acb9f..1eb267e3896c 100644 --- a/__tests__/e2e/data-loading/data.test.ts +++ b/__tests__/e2e/data-loading/data.test.ts @@ -54,7 +54,7 @@ describe('static data file support in vite 3', () => { document.querySelector('pre#basic')?.textContent === JSON.stringify([{ a: false }, { b: true }], null, 2), undefined, - { timeout: 3000 } + { timeout: 5000 } ) } finally { await fs.writeFile(a, JSON.stringify({ a: true }, null, 2) + '\n') @@ -69,7 +69,7 @@ describe('static data file support in vite 3', () => { document.querySelector('pre#basic')?.textContent === JSON.stringify([{ a: true }], null, 2), undefined, - { timeout: 3000 } + { timeout: 5000 } ) err = false } finally { @@ -85,7 +85,7 @@ describe('static data file support in vite 3', () => { document.querySelector('pre#basic')?.textContent === JSON.stringify([{ a: true }, { b: false }], null, 2), undefined, - { timeout: 3000 } + { timeout: 5000 } ) } finally { await fs.writeFile(b, JSON.stringify({ b: true }, null, 2) + '\n') diff --git a/package.json b/package.json index c3558638208f..c44921595ab3 100644 --- a/package.json +++ b/package.json @@ -107,6 +107,7 @@ "@vueuse/core": "^13.1.0", "@vueuse/integrations": "^13.1.0", "focus-trap": "^7.6.4", + "living-object": "0.0.8", "mark.js": "8.11.1", "minisearch": "^7.1.2", "shiki": "^3.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d4c6d0c319f3..9b4dce596cb6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -55,6 +55,9 @@ importers: focus-trap: specifier: ^7.6.4 version: 7.6.4 + living-object: + specifier: 0.0.8 + version: 0.0.8 mark.js: specifier: 8.11.1 version: 8.11.1 @@ -1966,6 +1969,10 @@ packages: resolution: {integrity: sha512-vsBzcU4oE+v0lj4FhVLzr9dBTv4/fHIa57l+GCwovP8MoFNZJTOhGU8PXd4v2VJCbECAaijBiHntiekFMLvo0g==} engines: {node: '>=18.0.0'} + living-object@0.0.8: + resolution: {integrity: sha512-o4SGS1iyo3H6m/OAbrxty0RFgXNIkx0vojHDGcAk/RjQ+noB0lsK2znmq19BZ+jyOS7P0jj5zywxgVNuKt5/Gg==} + engines: {node: '>=16.0.0'} + local-pkg@1.1.1: resolution: {integrity: sha512-WunYko2W1NcdfAFpuLUoucsgULmgDBRkdxHxWQ7mK0cQqwPiy8E1enjuRBrhLtZkB5iScJ1XIPdhVEFK8aOLSg==} engines: {node: '>=14'} @@ -4677,6 +4684,8 @@ snapshots: rfdc: 1.4.1 wrap-ansi: 9.0.0 + living-object@0.0.8: {} + local-pkg@1.1.1: dependencies: mlly: 1.7.4 diff --git a/src/client/app/components/ClientOnly.ts b/src/client/app/components/ClientOnly.ts index 680094ce5807..1781a371263a 100644 --- a/src/client/app/components/ClientOnly.ts +++ b/src/client/app/components/ClientOnly.ts @@ -1,7 +1,17 @@ import { defineComponent, onMounted, ref } from 'vue' export const ClientOnly = defineComponent({ - setup(_, { slots }) { + props: { + isClientOnly: { + type: Boolean, + default: true + } + }, + setup(props, { slots }) { + // Programmatically determine if this component should be + // client-only based on the presence of the isClientOnly attribute. + if (!props.isClientOnly) return () => slots.default?.(props) || null + const show = ref(false) onMounted(() => { diff --git a/src/client/theme-default/components/VPNavBarMenu.vue b/src/client/theme-default/components/VPNavBarMenu.vue index c4d741b97a97..e15cc48936ec 100644 --- a/src/client/theme-default/components/VPNavBarMenu.vue +++ b/src/client/theme-default/components/VPNavBarMenu.vue @@ -2,29 +2,32 @@ import { useData } from '../composables/data' import VPNavBarMenuLink from './VPNavBarMenuLink.vue' import VPNavBarMenuGroup from './VPNavBarMenuGroup.vue' +import { isClientOnly } from '../../shared' const { theme } = useData()