nuxt-custom-fetch 4.0.0-alpha.2 → 4.0.0-alpha.4

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.
@@ -1,5 +1,5 @@
1
1
  import { asyncDataDefaults, pendingWhenIdle } from "#build/nuxt.config.mjs";
2
- import { clearNuxtData, createError, getCurrentScope, onScopeDispose, reactive, ref, shallowRef, unref, useAsyncData, useRequestFetch, useRuntimeConfig, watch } from "#imports";
2
+ import { clearNuxtData, createError, getCurrentScope, onScopeDispose, reactive, ref, shallowRef, unref, useAsyncData, useNuxtApp, useRequestFetch, useRuntimeConfig, watch } from "#imports";
3
3
  import { hash, serialize } from "ohash";
4
4
  import { generateOptionSegments, Noop, pick } from "./utils.js";
5
5
  const _cachedController = /* @__PURE__ */ new Map();
@@ -133,7 +133,14 @@ export class CustomFetch {
133
133
  });
134
134
  };
135
135
  const controller = typeof AbortController !== "undefined" ? new AbortController() : {};
136
- if (import.meta.client) {
136
+ const nuxtApp = useNuxtApp();
137
+ if (import.meta.client && !nuxtApp.isHydrating) {
138
+ if (nuxtApp._asyncData[key]) {
139
+ return nuxtApp._asyncData[key].execute({
140
+ cause: "initial",
141
+ dedupe: options.dedupe
142
+ });
143
+ }
137
144
  const _ref = options.deep ? ref : shallowRef;
138
145
  options.default ??= () => asyncDataDefaults.value;
139
146
  const asyncData = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-custom-fetch",
3
3
  "type": "module",
4
- "version": "4.0.0-alpha.2",
4
+ "version": "4.0.0-alpha.4",
5
5
  "packageManager": "pnpm@8.15.3+sha1.64838798f519c18029c1e8a1310e16101fc2eda0",
6
6
  "license": "MIT",
7
7
  "repository": {