@quvel-kit/core 1.3.11 → 1.3.13

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.
@@ -4,7 +4,7 @@
4
4
  * Fetches data during SSR, serializes to client, and hydrates on mount.
5
5
  * Eliminates the need for a Pinia store per page for SSR data loading.
6
6
  */
7
- import { type Ref } from 'vue';
7
+ import { type Ref, type ComputedRef } from 'vue';
8
8
  /**
9
9
  * SSR data loading composable
10
10
  *
@@ -22,7 +22,7 @@ import { type Ref } from 'vue';
22
22
  */
23
23
  export declare function useSSRData<T>(key: string, fetcher: () => Promise<T>): {
24
24
  data: Ref<T | null>;
25
- isLoading: Ref<boolean>;
25
+ isLoading: ComputedRef<boolean>;
26
26
  error: Ref<Error | null>;
27
27
  };
28
28
  //# sourceMappingURL=useSSRData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSSRData.d.ts","sourceRoot":"","sources":["../../src/composables/useSSRData.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAejE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACxB;IACD,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACpB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;CAC1B,CAsDA"}
1
+ {"version":3,"file":"useSSRData.d.ts","sourceRoot":"","sources":["../../src/composables/useSSRData.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA8C,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAM7F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACxB;IACD,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACpB,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;CAC1B,CAgDA"}
@@ -4,19 +4,10 @@
4
4
  * Fetches data during SSR, serializes to client, and hydrates on mount.
5
5
  * Eliminates the need for a Pinia store per page for SSR data loading.
6
6
  */
7
- import { ref, onMounted, onServerPrefetch } from 'vue';
7
+ import { ref, computed, onMounted, onServerPrefetch } from 'vue';
8
8
  import { useQuvel } from './useQuvel.js';
9
9
  const SSR_DATA_PREFIX = '__SSR_DATA_';
10
10
  const SSR_ERROR_PREFIX = '__SSR_ERROR_';
11
- /**
12
- * Check if SSR data exists in window (for initial state)
13
- */
14
- function hasSSRData(key) {
15
- if (typeof window === 'undefined')
16
- return false;
17
- const win = window;
18
- return win[`${SSR_DATA_PREFIX}${key}`] !== undefined;
19
- }
20
11
  /**
21
12
  * SSR data loading composable
22
13
  *
@@ -39,7 +30,7 @@ export function useSSRData(key, fetcher) {
39
30
  const errorKey = `${SSR_ERROR_PREFIX}${key}`;
40
31
  const data = ref(null);
41
32
  const error = ref(null);
42
- const isLoading = ref(isSSR || !hasSSRData(key));
33
+ const isLoading = computed(() => data.value === null && error.value === null);
43
34
  if (isSSR) {
44
35
  onServerPrefetch(async () => {
45
36
  try {
@@ -52,9 +43,6 @@ export function useSSRData(key, fetcher) {
52
43
  error.value = err;
53
44
  container.windowBag?.set(errorKey, { message: err.message, name: err.name });
54
45
  }
55
- finally {
56
- isLoading.value = false;
57
- }
58
46
  });
59
47
  }
60
48
  else {
@@ -68,11 +56,9 @@ export function useSSRData(key, fetcher) {
68
56
  const err = new Error(ssrError.message);
69
57
  err.name = ssrError.name;
70
58
  error.value = err;
71
- isLoading.value = false;
72
59
  }
73
60
  else if (ssrData !== undefined) {
74
61
  data.value = ssrData;
75
- isLoading.value = false;
76
62
  }
77
63
  else {
78
64
  try {
@@ -81,9 +67,6 @@ export function useSSRData(key, fetcher) {
81
67
  catch (e) {
82
68
  error.value = e instanceof Error ? e : new Error(String(e));
83
69
  }
84
- finally {
85
- isLoading.value = false;
86
- }
87
70
  }
88
71
  });
89
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../src/utils/axios.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAqB,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAsCrD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CASnE;AAoBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,aAAa,CAgE1G"}
1
+ {"version":3,"file":"axios.d.ts","sourceRoot":"","sources":["../../src/utils/axios.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAqB,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAsCrD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CASnE;AAoBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,aAAa,CA+D1G"}
@@ -89,7 +89,6 @@ export function createApiInstance(ssrContext, appConfig) {
89
89
  const instance = axios.create(axiosConfig);
90
90
  let hasSessionCookie = false;
91
91
  if (ssrContext) {
92
- // Set Origin header so Sanctum recognizes SSR requests as stateful
93
92
  const frontendUrl = appConfig?.frontend?.url || ssrContext.req?.headers?.origin;
94
93
  if (frontendUrl) {
95
94
  instance.defaults.headers.common['Origin'] = frontendUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quvel-kit/core",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "description": "Core utilities for Quvel UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",