@remix-run/router 1.20.0-pre.0 → 1.20.0

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
  /**
2
- * @remix-run/router v1.20.0-pre.0
2
+ * @remix-run/router v1.20.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2435,15 +2435,12 @@
2435
2435
  shortCircuited: true
2436
2436
  };
2437
2437
  } else if (discoverResult.type === "error") {
2438
- let {
2439
- boundaryId,
2440
- error
2441
- } = handleDiscoverRouteError(location.pathname, discoverResult);
2438
+ let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
2442
2439
  return {
2443
2440
  matches: discoverResult.partialMatches,
2444
2441
  pendingActionResult: [boundaryId, {
2445
2442
  type: ResultType.error,
2446
- error
2443
+ error: discoverResult.error
2447
2444
  }]
2448
2445
  };
2449
2446
  } else if (!discoverResult.matches) {
@@ -2573,15 +2570,12 @@
2573
2570
  shortCircuited: true
2574
2571
  };
2575
2572
  } else if (discoverResult.type === "error") {
2576
- let {
2577
- boundaryId,
2578
- error
2579
- } = handleDiscoverRouteError(location.pathname, discoverResult);
2573
+ let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
2580
2574
  return {
2581
2575
  matches: discoverResult.partialMatches,
2582
2576
  loaderData: {},
2583
2577
  errors: {
2584
- [boundaryId]: error
2578
+ [boundaryId]: discoverResult.error
2585
2579
  }
2586
2580
  };
2587
2581
  } else if (!discoverResult.matches) {
@@ -2845,10 +2839,7 @@
2845
2839
  if (discoverResult.type === "aborted") {
2846
2840
  return;
2847
2841
  } else if (discoverResult.type === "error") {
2848
- let {
2849
- error
2850
- } = handleDiscoverRouteError(path, discoverResult);
2851
- setFetcherError(key, routeId, error, {
2842
+ setFetcherError(key, routeId, discoverResult.error, {
2852
2843
  flushSync
2853
2844
  });
2854
2845
  return;
@@ -3034,10 +3025,7 @@
3034
3025
  if (discoverResult.type === "aborted") {
3035
3026
  return;
3036
3027
  } else if (discoverResult.type === "error") {
3037
- let {
3038
- error
3039
- } = handleDiscoverRouteError(path, discoverResult);
3040
- setFetcherError(key, routeId, error, {
3028
+ setFetcherError(key, routeId, discoverResult.error, {
3041
3029
  flushSync
3042
3030
  });
3043
3031
  return;
@@ -3482,16 +3470,6 @@
3482
3470
  error
3483
3471
  };
3484
3472
  }
3485
- function handleDiscoverRouteError(pathname, discoverResult) {
3486
- return {
3487
- boundaryId: findNearestBoundary(discoverResult.partialMatches).route.id,
3488
- error: getInternalRouterError(400, {
3489
- type: "route-discovery",
3490
- pathname,
3491
- message: discoverResult.error != null && "message" in discoverResult.error ? discoverResult.error : String(discoverResult.error)
3492
- })
3493
- };
3494
- }
3495
3473
  function cancelActiveDeferreds(predicate) {
3496
3474
  let cancelledRouteIds = [];
3497
3475
  activeDeferreds.forEach((dfd, routeId) => {
@@ -5192,9 +5170,7 @@
5192
5170
  let errorMessage = "Unknown @remix-run/router error";
5193
5171
  if (status === 400) {
5194
5172
  statusText = "Bad Request";
5195
- if (type === "route-discovery") {
5196
- errorMessage = "Unable to match URL \"" + pathname + "\" - the `patchRoutesOnNavigation()` " + ("function threw the following error:\n" + message);
5197
- } else if (method && pathname && routeId) {
5173
+ if (method && pathname && routeId) {
5198
5174
  errorMessage = "You made a " + method + " request to \"" + pathname + "\" but " + ("did not provide a `loader` for route \"" + routeId + "\", ") + "so there is no way to handle the request.";
5199
5175
  } else if (type === "defer-action") {
5200
5176
  errorMessage = "defer() is not supported in actions";