@wcstack/router 4.1.0 → 4.1.1

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/index.esm.js CHANGED
@@ -2263,6 +2263,16 @@ function whenLoadOrderSettled(check) {
2263
2263
  check();
2264
2264
  }
2265
2265
 
2266
+ /**
2267
+ * A navigation another one took over — a guard's redirect, a newer navigation — rejects with an
2268
+ * `AbortError` (Navigation API). That is the designed outcome, not a failure: the write surfaces
2269
+ * (`navigateUrl` / `replaceUrl`) and the guard's fallback do not report it (docs/seam-apps.md,
2270
+ * router-auth — `navigateUrl` to a guarded page logged "navigate failed: AbortError").
2271
+ */
2272
+ function isAbortError(error) {
2273
+ return error?.name === "AbortError";
2274
+ }
2275
+
2266
2276
  /** 続けて起きた guard のリダイレクトの数(guard 相を通った遷移で数え直す) */
2267
2277
  const redirectCounts = new WeakMap();
2268
2278
  /** これを超えて続くリダイレクトはループとして止める(docs/seam-apps.md、router-auth) */
@@ -2340,7 +2350,8 @@ async function runGuardPhase(routerNode, matchResult) {
2340
2350
  .catch(() => { })
2341
2351
  .then(() => routerNode.replace(e.fallbackPath))
2342
2352
  .catch((err) => {
2343
- console.error('Fallback navigation failed:', err);
2353
+ if (!isAbortError(err))
2354
+ console.error('Fallback navigation failed:', err);
2344
2355
  });
2345
2356
  return false;
2346
2357
  }
@@ -3079,7 +3090,8 @@ class Router extends HTMLElement {
3079
3090
  return;
3080
3091
  this._navigateUrl = value;
3081
3092
  this.navigate(value).catch((err) => {
3082
- console.error(`${config.tagNames.router} navigate failed:`, err);
3093
+ if (!isAbortError(err))
3094
+ console.error(`${config.tagNames.router} navigate failed:`, err);
3083
3095
  }).finally(() => {
3084
3096
  this._navigateUrl = null;
3085
3097
  this.dispatchEvent(new CustomEvent("wcs-router:navigate-url-changed", {
@@ -3104,7 +3116,8 @@ class Router extends HTMLElement {
3104
3116
  return;
3105
3117
  this._replaceUrl = value;
3106
3118
  this.replace(value).catch((err) => {
3107
- console.error(`${config.tagNames.router} replace failed:`, err);
3119
+ if (!isAbortError(err))
3120
+ console.error(`${config.tagNames.router} replace failed:`, err);
3108
3121
  }).finally(() => {
3109
3122
  this._replaceUrl = null;
3110
3123
  this.dispatchEvent(new CustomEvent("wcs-router:replace-url-changed", {
@@ -4280,7 +4293,7 @@ function bootstrapRouter(config, registry) {
4280
4293
  registerComponents(registry);
4281
4294
  }
4282
4295
 
4283
- var version = "4.1.0";
4296
+ var version = "4.1.1";
4284
4297
  var pkg = {
4285
4298
  version: version};
4286
4299