@remix-run/router 1.14.2 → 1.15.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.14.2
2
+ * @remix-run/router v1.15.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -3277,7 +3277,8 @@
3277
3277
  }
3278
3278
  // Config driven behavior flags
3279
3279
  let future = _extends({
3280
- v7_relativeSplatPath: false
3280
+ v7_relativeSplatPath: false,
3281
+ v7_throwAbortReason: false
3281
3282
  }, opts ? opts.future : null);
3282
3283
  let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);
3283
3284
 
@@ -3500,8 +3501,7 @@
3500
3501
  requestContext
3501
3502
  });
3502
3503
  if (request.signal.aborted) {
3503
- let method = isRouteRequest ? "queryRoute" : "query";
3504
- throw new Error(method + "() call aborted: " + request.method + " " + request.url);
3504
+ throwStaticHandlerAbortedError(request, isRouteRequest, future);
3505
3505
  }
3506
3506
  }
3507
3507
  if (isRedirectResult(result)) {
@@ -3619,8 +3619,7 @@
3619
3619
  requestContext
3620
3620
  }))]);
3621
3621
  if (request.signal.aborted) {
3622
- let method = isRouteRequest ? "queryRoute" : "query";
3623
- throw new Error(method + "() call aborted: " + request.method + " " + request.url);
3622
+ throwStaticHandlerAbortedError(request, isRouteRequest, future);
3624
3623
  }
3625
3624
 
3626
3625
  // Process and commit output from loaders
@@ -3658,13 +3657,20 @@
3658
3657
  */
3659
3658
  function getStaticContextFromError(routes, context, error) {
3660
3659
  let newContext = _extends({}, context, {
3661
- statusCode: 500,
3660
+ statusCode: isRouteErrorResponse(error) ? error.status : 500,
3662
3661
  errors: {
3663
3662
  [context._deepestRenderedBoundaryId || routes[0].id]: error
3664
3663
  }
3665
3664
  });
3666
3665
  return newContext;
3667
3666
  }
3667
+ function throwStaticHandlerAbortedError(request, isRouteRequest, future) {
3668
+ if (future.v7_throwAbortReason && request.signal.reason !== undefined) {
3669
+ throw request.signal.reason;
3670
+ }
3671
+ let method = isRouteRequest ? "queryRoute" : "query";
3672
+ throw new Error(method + "() call aborted: " + request.method + " " + request.url);
3673
+ }
3668
3674
  function isSubmissionNavigation(opts) {
3669
3675
  return opts != null && ("formData" in opts && opts.formData != null || "body" in opts && opts.body !== undefined);
3670
3676
  }