@sit-onyx/nuxt-docs 0.8.1-dev-20261123092313 → 0.8.1-dev-20261124083509

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,17 +38,9 @@ export const useCollection = async <TCollection extends keyof Collections = keyo
38
38
 
39
39
  const key = computed(() => `collection-${collection.value}-${path.value}`);
40
40
 
41
- return useAsyncData(
42
- key,
43
- async () => {
44
- const data = await queryCollection(collection.value).path(path.value).first();
45
- if (data) return data;
46
- throw createError({ status: 404, message: "Page not found", fatal: true });
47
- },
48
- {
49
- // when multiple parallel requests are made for the same page, "defer" will make sure only the first
50
- // is executed and the result is shared with all other requests
51
- dedupe: "defer",
52
- },
53
- );
41
+ return useAsyncData(key, () => queryCollection(collection.value).path(path.value).first(), {
42
+ // when multiple parallel requests are made for the same page, "defer" will make sure only the first
43
+ // is executed and the result is shared with all other requests
44
+ dedupe: "defer",
45
+ });
54
46
  };
@@ -1,15 +1,31 @@
1
1
  <script setup lang="ts">
2
2
  import type { Collections } from "@nuxt/content";
3
- import type { NuxtLayouts } from "#app";
3
+ import type { NuxtError, NuxtLayouts } from "#app";
4
4
 
5
5
  definePageMeta({ layout: false });
6
6
 
7
7
  const { locale } = useI18n();
8
8
 
9
- const { data, error } = await useCollection({
9
+ const error = ref<NuxtError>();
10
+
11
+ const { data, error: collectionError } = await useCollection({
10
12
  collection: computed(() => `content_${locale.value}` as keyof Collections),
11
13
  });
12
14
 
15
+ watch(
16
+ [data, collectionError],
17
+ () => {
18
+ if (collectionError.value) {
19
+ error.value = collectionError.value;
20
+ } else if (!data.value) {
21
+ error.value = createError({ status: 404, message: "Page not found", fatal: true });
22
+ } else {
23
+ error.value = undefined;
24
+ }
25
+ },
26
+ { immediate: true },
27
+ );
28
+
13
29
  useSeoMeta({
14
30
  title: () => data.value?.seo.title,
15
31
  description: () => data.value?.seo.description,
@@ -24,7 +40,7 @@ const layout = computed<keyof NuxtLayouts>(() => {
24
40
 
25
41
  <template>
26
42
  <NuxtLayout :name="layout">
27
- <OnyxError v-if="error" :error />
43
+ <OnyxError v-if="error" :error="error" />
28
44
  <ContentRenderer v-else-if="data" :value="data" />
29
45
  </NuxtLayout>
30
46
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt-docs",
3
- "version": "0.8.1-dev-20261123092313",
3
+ "version": "0.8.1-dev-20261124083509",
4
4
  "description": "Nuxt layer/template for creating documentations with the onyx design system",
5
5
  "bugs": {
6
6
  "url": "https://github.com/SchwarzIT/onyx/issues"
@@ -21,7 +21,7 @@
21
21
  "type": "module",
22
22
  "main": "./nuxt.config.ts",
23
23
  "dependencies": {
24
- "@sit-onyx/mdc": "^0.3.1"
24
+ "@sit-onyx/mdc": "^0.3.2-dev-20261124083509"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@fontsource-variable/source-code-pro": "^5.3.1",
@@ -32,14 +32,14 @@
32
32
  "@nuxtjs/mdc": "~0.23.4",
33
33
  "@playwright/experimental-ct-vue": "1.62.1",
34
34
  "@playwright/test": "1.62.1",
35
- "@sit-onyx/icons": "^1.14.0-dev-20261123092313",
36
- "@sit-onyx/nuxt": "^1.2.0",
35
+ "@sit-onyx/icons": "^1.14.0-dev-20261124083509",
36
+ "@sit-onyx/nuxt": "^1.2.1-dev-20261124083509",
37
37
  "@sit-onyx/shared": "^0.1.0",
38
38
  "nuxt": "4.6.4",
39
39
  "sass-embedded": "1.108.2",
40
- "sit-onyx": "^1.23.0-dev-20261123092313",
40
+ "sit-onyx": "^1.23.0-dev-20261124083509",
41
41
  "typescript": "6.0.3",
42
- "vue": "3.5.44"
42
+ "vue": "3.5.46"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@fontsource-variable/source-code-pro": ">= 5",
@@ -48,13 +48,13 @@
48
48
  "@nuxtjs/color-mode": ">= 4",
49
49
  "@nuxtjs/i18n": ">= 10",
50
50
  "@nuxtjs/mdc": ">= 0.20.2",
51
- "@sit-onyx/icons": "^1.14.0-dev-20261123092313",
52
- "@sit-onyx/nuxt": "^1.2.0",
51
+ "@sit-onyx/icons": "^1.14.0-dev-20261124083509",
52
+ "@sit-onyx/nuxt": "^1.2.1-dev-20261124083509",
53
53
  "sass-embedded": ">= 1",
54
- "sit-onyx": "^1.23.0-dev-20261123092313"
54
+ "sit-onyx": "^1.23.0-dev-20261124083509"
55
55
  },
56
56
  "engines": {
57
- "node": ">=20"
57
+ "node": ">=22"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "pnpm dev:prepare && nuxi dev playground",