@remix-run/router 1.20.0-pre.0 → 1.20.0-pre.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/router.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/router v1.20.0-pre.0
2
+ * @remix-run/router v1.20.0-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2026,15 +2026,12 @@ function createRouter(init) {
2026
2026
  shortCircuited: true
2027
2027
  };
2028
2028
  } else if (discoverResult.type === "error") {
2029
- let {
2030
- boundaryId,
2031
- error
2032
- } = handleDiscoverRouteError(location.pathname, discoverResult);
2029
+ let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
2033
2030
  return {
2034
2031
  matches: discoverResult.partialMatches,
2035
2032
  pendingActionResult: [boundaryId, {
2036
2033
  type: ResultType.error,
2037
- error
2034
+ error: discoverResult.error
2038
2035
  }]
2039
2036
  };
2040
2037
  } else if (!discoverResult.matches) {
@@ -2158,15 +2155,12 @@ function createRouter(init) {
2158
2155
  shortCircuited: true
2159
2156
  };
2160
2157
  } else if (discoverResult.type === "error") {
2161
- let {
2162
- boundaryId,
2163
- error
2164
- } = handleDiscoverRouteError(location.pathname, discoverResult);
2158
+ let boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;
2165
2159
  return {
2166
2160
  matches: discoverResult.partialMatches,
2167
2161
  loaderData: {},
2168
2162
  errors: {
2169
- [boundaryId]: error
2163
+ [boundaryId]: discoverResult.error
2170
2164
  }
2171
2165
  };
2172
2166
  } else if (!discoverResult.matches) {
@@ -2418,10 +2412,7 @@ function createRouter(init) {
2418
2412
  if (discoverResult.type === "aborted") {
2419
2413
  return;
2420
2414
  } else if (discoverResult.type === "error") {
2421
- let {
2422
- error
2423
- } = handleDiscoverRouteError(path, discoverResult);
2424
- setFetcherError(key, routeId, error, {
2415
+ setFetcherError(key, routeId, discoverResult.error, {
2425
2416
  flushSync
2426
2417
  });
2427
2418
  return;
@@ -2598,10 +2589,7 @@ function createRouter(init) {
2598
2589
  if (discoverResult.type === "aborted") {
2599
2590
  return;
2600
2591
  } else if (discoverResult.type === "error") {
2601
- let {
2602
- error
2603
- } = handleDiscoverRouteError(path, discoverResult);
2604
- setFetcherError(key, routeId, error, {
2592
+ setFetcherError(key, routeId, discoverResult.error, {
2605
2593
  flushSync
2606
2594
  });
2607
2595
  return;
@@ -3026,16 +3014,6 @@ function createRouter(init) {
3026
3014
  error
3027
3015
  };
3028
3016
  }
3029
- function handleDiscoverRouteError(pathname, discoverResult) {
3030
- return {
3031
- boundaryId: findNearestBoundary(discoverResult.partialMatches).route.id,
3032
- error: getInternalRouterError(400, {
3033
- type: "route-discovery",
3034
- pathname,
3035
- message: discoverResult.error != null && "message" in discoverResult.error ? discoverResult.error : String(discoverResult.error)
3036
- })
3037
- };
3038
- }
3039
3017
  function cancelActiveDeferreds(predicate) {
3040
3018
  let cancelledRouteIds = [];
3041
3019
  activeDeferreds.forEach((dfd, routeId) => {
@@ -4664,9 +4642,7 @@ function getInternalRouterError(status, _temp5) {
4664
4642
  let errorMessage = "Unknown @remix-run/router error";
4665
4643
  if (status === 400) {
4666
4644
  statusText = "Bad Request";
4667
- if (type === "route-discovery") {
4668
- errorMessage = "Unable to match URL \"" + pathname + "\" - the `patchRoutesOnNavigation()` " + ("function threw the following error:\n" + message);
4669
- } else if (method && pathname && routeId) {
4645
+ if (method && pathname && routeId) {
4670
4646
  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.";
4671
4647
  } else if (type === "defer-action") {
4672
4648
  errorMessage = "defer() is not supported in actions";