nuxt-nightly 4.2.1-29373601.148264 → 4.2.1-29373755.3e1eb666

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.
@@ -356,16 +356,18 @@ function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
356
356
  (resolve, reject) => {
357
357
  try {
358
358
  const timeout = opts.timeout ?? options.timeout;
359
- const mergedSignal = mergeAbortSignals([asyncData._abortController?.signal, opts?.signal], timeout);
359
+ const mergedSignal = mergeAbortSignals(nuxtApp, [asyncData._abortController?.signal, opts?.signal], timeout);
360
360
  if (mergedSignal.aborted) {
361
361
  const reason = mergedSignal.reason;
362
362
  reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
363
363
  return;
364
364
  }
365
- mergedSignal.addEventListener("abort", () => {
365
+ const onAbort = () => {
366
366
  const reason = mergedSignal.reason;
367
367
  reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
368
- }, { once: true });
368
+ };
369
+ mergedSignal.addEventListener("abort", onAbort, { once: true });
370
+ removeListenerAfterRender(nuxtApp, mergedSignal, onAbort);
369
371
  return Promise.resolve(handler(nuxtApp, { signal: mergedSignal })).then(resolve, reject);
370
372
  } catch (err) {
371
373
  reject(err);
@@ -450,7 +452,7 @@ function createHash(_handler, options) {
450
452
  getCachedData: options.getCachedData ? hash(options.getCachedData) : void 0
451
453
  };
452
454
  }
453
- function mergeAbortSignals(signals, timeout) {
455
+ function mergeAbortSignals(nuxtApp, signals, timeout) {
454
456
  const list = signals.filter((s) => !!s);
455
457
  if (typeof timeout === "number" && timeout >= 0) {
456
458
  const timeoutSignal = AbortSignal.timeout?.(timeout);
@@ -484,6 +486,17 @@ function mergeAbortSignals(signals, timeout) {
484
486
  };
485
487
  for (const sig of list) {
486
488
  sig.addEventListener?.("abort", onAbort, { once: true });
489
+ removeListenerAfterRender(nuxtApp, sig, onAbort);
487
490
  }
488
491
  return controller.signal;
489
492
  }
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-29373601.00148264";
3838
+ const version = "4.2.1-29373755.3e1eb666";
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-29373601.00148264",
3
+ "version": "4.2.1-29373755.3e1eb666",
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-29373601.00148264",
71
- "@nuxt/nitro-server": "npm:@nuxt/nitro-server-nightly@4.2.1-29373601.00148264",
72
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.1-29373601.00148264",
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",
73
73
  "@nuxt/telemetry": "^2.6.6",
74
- "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.2.1-29373601.00148264",
74
+ "@nuxt/vite-builder": "npm:@nuxt/vite-builder-nightly@4.2.1-29373755.3e1eb666",
75
75
  "@unhead/vue": "^2.0.19",
76
76
  "@vue/shared": "^3.5.22",
77
77
  "c12": "^3.3.1",