nuxt-nightly 4.1.3-29329120.ce0fe6f6 → 4.1.3-29329334.c7041516
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/app/composables/asyncData.js +19 -10
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
|
@@ -56,14 +56,17 @@ ${warnings.map((w) => `- ${w}`).join("\n")}
|
|
|
56
56
|
You can use a different key or move the call to a composable to ensure the options are shared across calls.`);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
function createInitialFetch() {
|
|
60
|
+
const initialFetchOptions = { cause: "initial", dedupe: options.dedupe };
|
|
61
|
+
if (!nuxtApp._asyncData[key.value]?._init) {
|
|
62
|
+
initialFetchOptions.cachedData = options.getCachedData(key.value, nuxtApp, { cause: "initial" });
|
|
63
|
+
nuxtApp._asyncData[key.value] = createAsyncData(nuxtApp, key.value, _handler, options, initialFetchOptions.cachedData);
|
|
64
|
+
}
|
|
65
|
+
return () => nuxtApp._asyncData[key.value].execute(initialFetchOptions);
|
|
63
66
|
}
|
|
67
|
+
const initialFetch = createInitialFetch();
|
|
64
68
|
const asyncData = nuxtApp._asyncData[key.value];
|
|
65
69
|
asyncData._deps++;
|
|
66
|
-
const initialFetch = () => nuxtApp._asyncData[key.value].execute(initialFetchOptions);
|
|
67
70
|
const fetchOnServer = options.server !== false && nuxtApp.payload.serverRendered;
|
|
68
71
|
if (import.meta.server && fetchOnServer && options.immediate) {
|
|
69
72
|
const promise = initialFetch();
|
|
@@ -120,14 +123,14 @@ You can use a different key or move the call to a composable to ensure the optio
|
|
|
120
123
|
keyChanging = true;
|
|
121
124
|
const hadData = nuxtApp._asyncData[oldKey]?.data.value !== void 0;
|
|
122
125
|
const wasRunning = nuxtApp._asyncDataPromises[oldKey] !== void 0;
|
|
123
|
-
const
|
|
126
|
+
const initialFetchOptions = { cause: "initial", dedupe: options.dedupe };
|
|
124
127
|
if (!nuxtApp._asyncData[newKey]?._init) {
|
|
125
128
|
let initialValue;
|
|
126
129
|
if (oldKey && hadData) {
|
|
127
130
|
initialValue = nuxtApp._asyncData[oldKey].data.value;
|
|
128
131
|
} else {
|
|
129
132
|
initialValue = options.getCachedData(newKey, nuxtApp, { cause: "initial" });
|
|
130
|
-
|
|
133
|
+
initialFetchOptions.cachedData = initialValue;
|
|
131
134
|
}
|
|
132
135
|
nuxtApp._asyncData[newKey] = createAsyncData(nuxtApp, newKey, _handler, options, initialValue);
|
|
133
136
|
}
|
|
@@ -136,7 +139,7 @@ You can use a different key or move the call to a composable to ensure the optio
|
|
|
136
139
|
unregister(oldKey);
|
|
137
140
|
}
|
|
138
141
|
if (options.immediate || hadData || wasRunning) {
|
|
139
|
-
nuxtApp._asyncData[newKey].execute(
|
|
142
|
+
nuxtApp._asyncData[newKey].execute(initialFetchOptions);
|
|
140
143
|
}
|
|
141
144
|
queuePostFlushCb(() => {
|
|
142
145
|
keyChanging = false;
|
|
@@ -163,8 +166,14 @@ You can use a different key or move the call to a composable to ensure the optio
|
|
|
163
166
|
pending: writableComputedRef(() => nuxtApp._asyncData[key.value]?.pending),
|
|
164
167
|
status: writableComputedRef(() => nuxtApp._asyncData[key.value]?.status),
|
|
165
168
|
error: writableComputedRef(() => nuxtApp._asyncData[key.value]?.error),
|
|
166
|
-
refresh: (...args2) =>
|
|
167
|
-
|
|
169
|
+
refresh: (...args2) => {
|
|
170
|
+
if (!nuxtApp._asyncData[key.value]?._init) {
|
|
171
|
+
const initialFetch2 = createInitialFetch();
|
|
172
|
+
return initialFetch2();
|
|
173
|
+
}
|
|
174
|
+
return nuxtApp._asyncData[key.value].execute(...args2);
|
|
175
|
+
},
|
|
176
|
+
execute: (...args2) => asyncReturn.refresh(...args2),
|
|
168
177
|
clear: () => clearNuxtDataByKey(nuxtApp, key.value)
|
|
169
178
|
};
|
|
170
179
|
const asyncDataPromise = Promise.resolve(nuxtApp._asyncDataPromises[key.value]).then(() => asyncReturn);
|
package/dist/index.mjs
CHANGED
|
@@ -3830,7 +3830,7 @@ function addDeclarationTemplates(ctx, options) {
|
|
|
3830
3830
|
});
|
|
3831
3831
|
}
|
|
3832
3832
|
|
|
3833
|
-
const version = "4.1.3-
|
|
3833
|
+
const version = "4.1.3-29329334.c7041516";
|
|
3834
3834
|
|
|
3835
3835
|
const createImportProtectionPatterns = (nuxt, options) => {
|
|
3836
3836
|
const patterns = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-nightly",
|
|
3
|
-
"version": "4.1.3-
|
|
3
|
+
"version": "4.1.3-29329334.c7041516",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
|
|
68
68
|
"@nuxt/devalue": "^2.0.2",
|
|
69
69
|
"@nuxt/devtools": "^2.6.5",
|
|
70
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.3-
|
|
71
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.3-
|
|
70
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.3-29329334.c7041516",
|
|
71
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.3-29329334.c7041516",
|
|
72
72
|
"@nuxt/telemetry": "^2.6.6",
|
|
73
|
-
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.3-
|
|
73
|
+
"@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.1.3-29329334.c7041516",
|
|
74
74
|
"@unhead/vue": "^2.0.14",
|
|
75
75
|
"@vue/shared": "^3.5.22",
|
|
76
76
|
"c12": "^3.3.0",
|