@remix-run/router 1.16.0-pre.0 → 1.16.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.16.0-pre.0
2
+ * @remix-run/router v1.16.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -3351,23 +3351,17 @@
3351
3351
  * propagate that out and return the raw Response so the HTTP server can
3352
3352
  * return it directly.
3353
3353
  *
3354
- * - `opts.loadRouteIds` is an optional array of routeIds to run only a subset of
3355
- * loaders during a query() call
3356
3354
  * - `opts.requestContext` is an optional server context that will be passed
3357
3355
  * to actions/loaders in the `context` parameter
3358
3356
  * - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent
3359
3357
  * the bubbling of errors which allows single-fetch-type implementations
3360
3358
  * where the client will handle the bubbling and we may need to return data
3361
3359
  * for the handling route
3362
- * - `opts.skipLoaders` is an optional parameter that will prevent loaders
3363
- * from running after an action
3364
3360
  */
3365
3361
  async function query(request, _temp3) {
3366
3362
  let {
3367
- loadRouteIds,
3368
3363
  requestContext,
3369
3364
  skipLoaderErrorBubbling,
3370
- skipLoaders,
3371
3365
  unstable_dataStrategy
3372
3366
  } = _temp3 === void 0 ? {} : _temp3;
3373
3367
  let url = new URL(request.url);
@@ -3421,7 +3415,7 @@
3421
3415
  activeDeferreds: null
3422
3416
  };
3423
3417
  }
3424
- let result = await queryImpl(request, location, matches, requestContext, unstable_dataStrategy || null, loadRouteIds || null, skipLoaderErrorBubbling === true, skipLoaders === true, null);
3418
+ let result = await queryImpl(request, location, matches, requestContext, unstable_dataStrategy || null, skipLoaderErrorBubbling === true, null);
3425
3419
  if (isResponse(result)) {
3426
3420
  return result;
3427
3421
  }
@@ -3493,7 +3487,7 @@
3493
3487
  pathname: location.pathname
3494
3488
  });
3495
3489
  }
3496
- let result = await queryImpl(request, location, matches, requestContext, null, null, false, false, match);
3490
+ let result = await queryImpl(request, location, matches, requestContext, null, false, match);
3497
3491
  if (isResponse(result)) {
3498
3492
  return result;
3499
3493
  }
@@ -3520,14 +3514,14 @@
3520
3514
  }
3521
3515
  return undefined;
3522
3516
  }
3523
- async function queryImpl(request, location, matches, requestContext, unstable_dataStrategy, loadRouteIds, skipLoaderErrorBubbling, skipLoaders, routeMatch) {
3517
+ async function queryImpl(request, location, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch) {
3524
3518
  invariant(request.signal, "query()/queryRoute() requests must contain an AbortController signal");
3525
3519
  try {
3526
3520
  if (isMutationMethod(request.method.toLowerCase())) {
3527
- let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, unstable_dataStrategy, loadRouteIds, skipLoaderErrorBubbling, skipLoaders, routeMatch != null);
3521
+ let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch != null);
3528
3522
  return result;
3529
3523
  }
3530
- let result = await loadRouteData(request, matches, requestContext, unstable_dataStrategy, loadRouteIds, skipLoaderErrorBubbling, routeMatch);
3524
+ let result = await loadRouteData(request, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch);
3531
3525
  return isResponse(result) ? result : _extends({}, result, {
3532
3526
  actionData: null,
3533
3527
  actionHeaders: {}
@@ -3550,7 +3544,7 @@
3550
3544
  throw e;
3551
3545
  }
3552
3546
  }
3553
- async function submit(request, matches, actionMatch, requestContext, unstable_dataStrategy, loadRouteIds, skipLoaderErrorBubbling, skipLoaders, isRouteRequest) {
3547
+ async function submit(request, matches, actionMatch, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, isRouteRequest) {
3554
3548
  let result;
3555
3549
  if (!actionMatch.route.action && !actionMatch.route.lazy) {
3556
3550
  let error = getInternalRouterError(405, {
@@ -3628,51 +3622,18 @@
3628
3622
  // Store off the pending error - we use it to determine which loaders
3629
3623
  // to call and will commit it when we complete the navigation
3630
3624
  let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);
3631
- let statusCode = isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500;
3632
- let actionHeaders = _extends({}, result.headers ? {
3633
- [actionMatch.route.id]: result.headers
3634
- } : {});
3635
- if (skipLoaders) {
3636
- return {
3637
- matches,
3638
- loaderData: {},
3639
- actionData: {},
3640
- errors: {
3641
- [boundaryMatch.route.id]: result.error
3642
- },
3643
- statusCode,
3644
- loaderHeaders: {},
3645
- actionHeaders,
3646
- activeDeferreds: null
3647
- };
3648
- }
3649
- let context = await loadRouteData(loaderRequest, matches, requestContext, unstable_dataStrategy, loadRouteIds, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);
3625
+ let context = await loadRouteData(loaderRequest, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, null, [boundaryMatch.route.id, result]);
3650
3626
 
3651
3627
  // action status codes take precedence over loader status codes
3652
3628
  return _extends({}, context, {
3653
- statusCode,
3629
+ statusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,
3654
3630
  actionData: null,
3655
- actionHeaders
3631
+ actionHeaders: _extends({}, result.headers ? {
3632
+ [actionMatch.route.id]: result.headers
3633
+ } : {})
3656
3634
  });
3657
3635
  }
3658
- let actionHeaders = result.headers ? {
3659
- [actionMatch.route.id]: result.headers
3660
- } : {};
3661
- if (skipLoaders) {
3662
- return {
3663
- matches,
3664
- loaderData: {},
3665
- actionData: {
3666
- [actionMatch.route.id]: result.data
3667
- },
3668
- errors: null,
3669
- statusCode: result.statusCode || 200,
3670
- loaderHeaders: {},
3671
- actionHeaders,
3672
- activeDeferreds: null
3673
- };
3674
- }
3675
- let context = await loadRouteData(loaderRequest, matches, requestContext, unstable_dataStrategy, loadRouteIds, skipLoaderErrorBubbling, null);
3636
+ let context = await loadRouteData(loaderRequest, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, null);
3676
3637
  return _extends({}, context, {
3677
3638
  actionData: {
3678
3639
  [actionMatch.route.id]: result.data
@@ -3685,7 +3646,7 @@
3685
3646
  } : {}
3686
3647
  });
3687
3648
  }
3688
- async function loadRouteData(request, matches, requestContext, unstable_dataStrategy, loadRouteIds, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {
3649
+ async function loadRouteData(request, matches, requestContext, unstable_dataStrategy, skipLoaderErrorBubbling, routeMatch, pendingActionResult) {
3689
3650
  let isRouteRequest = routeMatch != null;
3690
3651
 
3691
3652
  // Short circuit if we have no loaders to run (queryRoute())
@@ -3698,9 +3659,6 @@
3698
3659
  }
3699
3660
  let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;
3700
3661
  let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);
3701
- if (loadRouteIds) {
3702
- matchesToLoad = matchesToLoad.filter(m => loadRouteIds.includes(m.route.id));
3703
- }
3704
3662
 
3705
3663
  // Short circuit if we have no loaders to run (query())
3706
3664
  if (matchesToLoad.length === 0) {