@remix-run/router 0.0.0-experimental-e157216e3 → 0.0.0-experimental-c5cae38f3

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 v0.0.0-experimental-e157216e3
2
+ * @remix-run/router v0.0.0-experimental-c5cae38f3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -3525,7 +3525,7 @@ function createRouter(init) {
3525
3525
  let route = partialMatches.length > 0 ? partialMatches[partialMatches.length - 1].route : null;
3526
3526
  while (true) {
3527
3527
  try {
3528
- await loadLazyRouteChildren(route, patchRoutesOnMissImpl, pathname, partialMatches, dataRoutes || inFlightDataRoutes, manifest, mapRouteProperties, pendingPatchRoutes, signal);
3528
+ await loadLazyRouteChildren(patchRoutesOnMissImpl, pathname, partialMatches, dataRoutes || inFlightDataRoutes, manifest, mapRouteProperties, pendingPatchRoutes, signal);
3529
3529
  if (signal.aborted) {
3530
3530
  return {
3531
3531
  type: "aborted"
@@ -4452,29 +4452,24 @@ function shouldRevalidateLoader(loaderMatch, arg) {
4452
4452
  * Idempotent utility to execute route.children() method to lazily load route
4453
4453
  * definitions and update the routes/routeManifest
4454
4454
  */
4455
- async function loadLazyRouteChildren(route, patchRoutesOnMissImpl, path, matches, routes, manifest, mapRouteProperties, pendingRouteChildren, signal) {
4455
+ async function loadLazyRouteChildren(patchRoutesOnMissImpl, path, matches, routes, manifest, mapRouteProperties, pendingRouteChildren, signal) {
4456
4456
  let key = [path, ...matches.map(m => m.route.id)].join("-");
4457
- let pending = pendingRouteChildren.get(key);
4458
- let children = null;
4459
- if (!pending) {
4460
- let maybePromise = patchRoutesOnMissImpl(path, matches, (r, c) => patchRoutes(r, c, routes, manifest, mapRouteProperties));
4461
- if (isPromise(maybePromise)) {
4462
- pending = maybePromise;
4463
- pendingRouteChildren.set(key, pending);
4464
- } else {
4465
- children = maybePromise;
4466
- }
4467
- }
4468
4457
  try {
4469
- if (pending) {
4470
- children = await pending;
4458
+ let pending = pendingRouteChildren.get(key);
4459
+ if (!pending) {
4460
+ pending = patchRoutesOnMissImpl({
4461
+ path,
4462
+ matches,
4463
+ patch: (routeId, children) => {
4464
+ if (!signal.aborted) {
4465
+ patchRoutes(routeId, children, routes, manifest, mapRouteProperties);
4466
+ }
4467
+ }
4468
+ });
4469
+ pendingRouteChildren.set(key, pending);
4471
4470
  }
4472
- if (children && !signal.aborted) {
4473
- if (route) {
4474
- patchRoutes(route.id, children, routes, manifest, mapRouteProperties);
4475
- } else {
4476
- warning(false, "You cannot return routes from `patchRoutesOnMiss` when there were no " + "partial matches, since React Router doesn't know where to patch the " + "routes. Please use `patch(routeId, children)` instead.");
4477
- }
4471
+ if (pending && isPromise(pending)) {
4472
+ await pending;
4478
4473
  }
4479
4474
  } finally {
4480
4475
  pendingRouteChildren.delete(key);