nuxt-nightly 4.2.1-29373755.3e1eb666 → 4.2.1-29373901.6b5d7717

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.
@@ -352,22 +352,21 @@ function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
352
352
  }
353
353
  asyncData._abortController = new AbortController();
354
354
  asyncData.status.value = "pending";
355
+ const cleanupController = new AbortController();
355
356
  const promise = new Promise(
356
357
  (resolve, reject) => {
357
358
  try {
358
359
  const timeout = opts.timeout ?? options.timeout;
359
- const mergedSignal = mergeAbortSignals(nuxtApp, [asyncData._abortController?.signal, opts?.signal], timeout);
360
+ const mergedSignal = mergeAbortSignals([asyncData._abortController?.signal, opts?.signal], cleanupController.signal, timeout);
360
361
  if (mergedSignal.aborted) {
361
362
  const reason = mergedSignal.reason;
362
363
  reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
363
364
  return;
364
365
  }
365
- const onAbort = () => {
366
+ mergedSignal.addEventListener("abort", () => {
366
367
  const reason = mergedSignal.reason;
367
368
  reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
368
- };
369
- mergedSignal.addEventListener("abort", onAbort, { once: true });
370
- removeListenerAfterRender(nuxtApp, mergedSignal, onAbort);
369
+ }, { once: true, signal: cleanupController.signal });
371
370
  return Promise.resolve(handler(nuxtApp, { signal: mergedSignal })).then(resolve, reject);
372
371
  } catch (err) {
373
372
  reject(err);
@@ -408,6 +407,7 @@ function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
408
407
  if (pendingWhenIdle) {
409
408
  asyncData.pending.value = false;
410
409
  }
410
+ cleanupController.abort();
411
411
  delete nuxtApp._asyncDataPromises[key];
412
412
  });
413
413
  nuxtApp._asyncDataPromises[key] = promise;
@@ -452,7 +452,7 @@ function createHash(_handler, options) {
452
452
  getCachedData: options.getCachedData ? hash(options.getCachedData) : void 0
453
453
  };
454
454
  }
455
- function mergeAbortSignals(nuxtApp, signals, timeout) {
455
+ function mergeAbortSignals(signals, cleanupSignal, timeout) {
456
456
  const list = signals.filter((s) => !!s);
457
457
  if (typeof timeout === "number" && timeout >= 0) {
458
458
  const timeoutSignal = AbortSignal.timeout?.(timeout);
@@ -485,18 +485,7 @@ function mergeAbortSignals(nuxtApp, signals, timeout) {
485
485
  }
486
486
  };
487
487
  for (const sig of list) {
488
- sig.addEventListener?.("abort", onAbort, { once: true });
489
- removeListenerAfterRender(nuxtApp, sig, onAbort);
488
+ sig.addEventListener?.("abort", onAbort, { once: true, signal: cleanupSignal });
490
489
  }
491
490
  return controller.signal;
492
491
  }
493
- function removeListenerAfterRender(nuxtApp, sig, onAbort) {
494
- if (!import.meta.server) {
495
- return;
496
- }
497
- for (const hook of ["app:rendered", "app:error"]) {
498
- nuxtApp.hooks.hookOnce(hook, () => {
499
- sig.removeEventListener?.("abort", onAbort);
500
- });
501
- }
502
- }
package/dist/index.mjs CHANGED
@@ -3835,7 +3835,7 @@ function addDeclarationTemplates(ctx, options) {
3835
3835
  });
3836
3836
  }
3837
3837
 
3838
- const version = "4.2.1-29373755.3e1eb666";
3838
+ const version = "4.2.1-29373901.6b5d7717";
3839
3839
 
3840
3840
  function createImportProtectionPatterns(nuxt, options) {
3841
3841
  const patterns = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-nightly",
3
- "version": "4.2.1-29373755.3e1eb666",
3
+ "version": "4.2.1-29373901.6b5d7717",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -67,11 +67,11 @@
67
67
  "@dxup/nuxt": "^0.2.1",
68
68
  "@nuxt/cli": "npm:@nuxt/cli-nightly@latest",
69
69
  "@nuxt/devtools": "^3.0.1",
70
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.1-29373755.3e1eb666",
71
- "@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@4.2.1-29373755.3e1eb666",
72
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.1-29373755.3e1eb666",
70
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.1-29373901.6b5d7717",
71
+ "@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@4.2.1-29373901.6b5d7717",
72
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.1-29373901.6b5d7717",
73
73
  "@nuxt/telemetry": "^2.6.6",
74
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.2.1-29373755.3e1eb666",
74
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.2.1-29373901.6b5d7717",
75
75
  "@unhead/vue": "^2.0.19",
76
76
  "@vue/shared": "^3.5.22",
77
77
  "c12": "^3.3.1",