@wpnuxt/core 2.0.0-alpha.5 → 2.0.0-alpha.6

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.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "2.0.0-alpha.4",
7
+ "version": "2.0.0-alpha.5",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,14 +1,5 @@
1
1
  import { getRelativeImagePath } from "../util/images.js";
2
2
  import { computed, ref, watch as vueWatch, useAsyncGraphqlQuery } from "#imports";
3
- function defaultGetCachedData(key, nuxtApp, ctx) {
4
- if (nuxtApp.isHydrating) {
5
- return nuxtApp.payload.data[key];
6
- }
7
- if (ctx.cause === "refresh:manual" || ctx.cause === "refresh:hook") {
8
- return void 0;
9
- }
10
- return nuxtApp.payload.data[key] ?? nuxtApp.static.data[key];
11
- }
12
3
  export const useWPContent = (queryName, nodes, fixImagePaths, params, options) => {
13
4
  const {
14
5
  clientCache,
@@ -23,12 +14,12 @@ export const useWPContent = (queryName, nodes, fixImagePaths, params, options) =
23
14
  const baseRetryDelay = retryDelayOption ?? 1e3;
24
15
  const retryCount = ref(0);
25
16
  const isRetrying = ref(false);
26
- const timeoutMs = timeoutOption ?? 3e4;
17
+ const timeoutMs = timeoutOption ?? 0;
27
18
  const graphqlCaching = clientCache === false ? { client: false } : restOptions.graphqlCaching ?? { client: true };
28
19
  const paramsKey = params ? JSON.stringify(params) : "{}";
29
20
  const baseKey = `wpnuxt-${String(queryName)}-${paramsKey}`;
30
21
  const finalKey = cacheKey ? `${baseKey}-${cacheKey}` : baseKey;
31
- const effectiveGetCachedData = userGetCachedData ?? (clientCache === false ? () => void 0 : defaultGetCachedData);
22
+ const effectiveGetCachedData = userGetCachedData ?? (clientCache === false ? () => void 0 : void 0);
32
23
  let abortController;
33
24
  let timeoutId;
34
25
  if (timeoutMs > 0) {
@@ -45,7 +36,9 @@ export const useWPContent = (queryName, nodes, fixImagePaths, params, options) =
45
36
  graphqlCaching,
46
37
  // Explicit key ensures consistent cache lookups
47
38
  key: finalKey,
48
- getCachedData: effectiveGetCachedData,
39
+ // Only set getCachedData if user provided one or wants to disable caching
40
+ // Otherwise let nuxt-graphql-middleware handle it with $graphqlCache
41
+ ...effectiveGetCachedData && { getCachedData: effectiveGetCachedData },
49
42
  // Pass abort signal for timeout support
50
43
  ...abortController && {
51
44
  fetchOptions: {
@@ -66,7 +59,7 @@ export const useWPContent = (queryName, nodes, fixImagePaths, params, options) =
66
59
  clearTimeout(timeoutId);
67
60
  timeoutId = void 0;
68
61
  }
69
- });
62
+ }, { immediate: true });
70
63
  }
71
64
  if (maxRetries > 0) {
72
65
  vueWatch(error, async (newError) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpnuxt/core",
3
- "version": "2.0.0-alpha.5",
3
+ "version": "2.0.0-alpha.6",
4
4
  "description": "Nuxt module for WordPress integration via GraphQL (WPGraphQL)",
5
5
  "keywords": [
6
6
  "nuxt",