react-router 0.0.0-experimental-573acd4d4 → 0.0.0-experimental-856ae8c29

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.
Files changed (43) hide show
  1. package/dist/development/{chunk-6DVU7PCU.mjs → chunk-SFY5YCQ7.mjs} +100 -106
  2. package/dist/development/dom-export.d.mts +2 -2
  3. package/dist/development/dom-export.d.ts +2 -2
  4. package/dist/development/dom-export.js +46 -53
  5. package/dist/development/dom-export.mjs +2 -2
  6. package/dist/development/{browser-Dpxu0wdb.d.ts → fog-of-war-BHTxbJsu.d.ts} +14 -14
  7. package/dist/{production/browser-Dpxu0wdb.d.ts → development/fog-of-war-DwsWwUlp.d.mts} +14 -14
  8. package/dist/development/index.d.mts +10 -11
  9. package/dist/development/index.d.ts +10 -11
  10. package/dist/development/index.js +101 -108
  11. package/dist/development/index.mjs +8 -10
  12. package/dist/development/lib/types/route-module.d.mts +1 -1
  13. package/dist/development/lib/types/route-module.d.ts +1 -1
  14. package/dist/development/lib/types/route-module.js +1 -1
  15. package/dist/development/lib/types/route-module.mjs +1 -1
  16. package/dist/{production/route-data-DX3MskAN.d.mts → development/route-data-BIYebJr3.d.mts} +3 -2
  17. package/dist/{production/route-data-DX3MskAN.d.ts → development/route-data-BIYebJr3.d.ts} +3 -2
  18. package/dist/development/{server.d.mts → rsc-export.d.mts} +20 -6
  19. package/dist/development/{server.d.ts → rsc-export.d.ts} +20 -6
  20. package/dist/development/{server.js → rsc-export.js} +125 -35
  21. package/dist/development/{server.mjs → rsc-export.mjs} +125 -34
  22. package/dist/production/{chunk-ZHQUHC3T.mjs → chunk-NUCSZUCR.mjs} +100 -106
  23. package/dist/production/dom-export.d.mts +2 -2
  24. package/dist/production/dom-export.d.ts +2 -2
  25. package/dist/production/dom-export.js +46 -53
  26. package/dist/production/dom-export.mjs +2 -2
  27. package/dist/{development/browser-B_fyLsf9.d.mts → production/fog-of-war-BHTxbJsu.d.ts} +14 -14
  28. package/dist/production/{browser-B_fyLsf9.d.mts → fog-of-war-DwsWwUlp.d.mts} +14 -14
  29. package/dist/production/index.d.mts +10 -11
  30. package/dist/production/index.d.ts +10 -11
  31. package/dist/production/index.js +101 -108
  32. package/dist/production/index.mjs +8 -10
  33. package/dist/production/lib/types/route-module.d.mts +1 -1
  34. package/dist/production/lib/types/route-module.d.ts +1 -1
  35. package/dist/production/lib/types/route-module.js +1 -1
  36. package/dist/production/lib/types/route-module.mjs +1 -1
  37. package/dist/{development/route-data-DX3MskAN.d.ts → production/route-data-BIYebJr3.d.mts} +3 -2
  38. package/dist/{development/route-data-DX3MskAN.d.mts → production/route-data-BIYebJr3.d.ts} +3 -2
  39. package/dist/production/{server.d.mts → rsc-export.d.mts} +20 -6
  40. package/dist/production/{server.d.ts → rsc-export.d.ts} +20 -6
  41. package/dist/production/{server.js → rsc-export.js} +125 -35
  42. package/dist/production/{server.mjs → rsc-export.mjs} +125 -34
  43. package/package.json +14 -26
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-573acd4d4
2
+ * react-router v0.0.0-experimental-856ae8c29
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1139,7 +1139,14 @@ function createRouter(init) {
1139
1139
  if (newState.matches) {
1140
1140
  newState.matches = newState.matches.map((m) => {
1141
1141
  let route = manifest[m.route.id];
1142
- return { ...m, route };
1142
+ let matchRoute = m.route;
1143
+ if (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) {
1144
+ return {
1145
+ ...m,
1146
+ route
1147
+ };
1148
+ }
1149
+ return m;
1143
1150
  });
1144
1151
  }
1145
1152
  state = {
@@ -3623,7 +3630,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
3623
3630
  function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2, allowElementMutations) {
3624
3631
  let childrenToPatch;
3625
3632
  if (routeId) {
3626
- let route = findRouteRecursively(routeId, routesToUse);
3633
+ let route = manifest[routeId];
3627
3634
  invariant(
3628
3635
  route,
3629
3636
  `No route found to patch children into: routeId = ${routeId}`
@@ -3659,19 +3666,20 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
3659
3666
  if (allowElementMutations && existingChildren.length > 0) {
3660
3667
  for (let i = 0; i < existingChildren.length; i++) {
3661
3668
  let { existingRoute, newRoute } = existingChildren[i];
3662
- let existingRouteAny = existingRoute;
3663
- let [newRouteAny] = convertRoutesToDataRoutes(
3669
+ let existingRouteTyped = existingRoute;
3670
+ let [newRouteTyped] = convertRoutesToDataRoutes(
3664
3671
  [newRoute],
3665
3672
  mapRouteProperties2,
3666
3673
  [],
3667
3674
  // Doesn't matter for mutated routes since they already have an id
3668
- manifest,
3675
+ {},
3676
+ // Don't touch the manifest here since we're updating in place
3669
3677
  true
3670
3678
  );
3671
- Object.assign(existingRouteAny, {
3672
- element: newRouteAny.element ? newRouteAny.element : existingRouteAny.element,
3673
- errorElement: newRouteAny.errorElement ? newRouteAny.errorElement : existingRouteAny.errorElement,
3674
- hydrateFallbackElement: newRouteAny.hydrateFallbackElement ? newRouteAny.hydrateFallbackElement : existingRouteAny.hydrateFallbackElement
3679
+ Object.assign(existingRouteTyped, {
3680
+ element: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element,
3681
+ errorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement,
3682
+ hydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement
3675
3683
  });
3676
3684
  }
3677
3685
  }
@@ -3690,20 +3698,6 @@ function isSameRoute(newRoute, existingRoute) {
3690
3698
  (aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))
3691
3699
  );
3692
3700
  }
3693
- function findRouteRecursively(id, routes) {
3694
- for (const route of routes) {
3695
- if (route.id === id) {
3696
- return route;
3697
- }
3698
- if (route.children) {
3699
- const found = findRouteRecursively(id, route.children);
3700
- if (found) {
3701
- return found;
3702
- }
3703
- }
3704
- }
3705
- return null;
3706
- }
3707
3701
  var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
3708
3702
  var loadLazyRouteProperty = ({
3709
3703
  key,
@@ -6736,9 +6730,8 @@ function unwrapSingleFetchResult(result, routeId) {
6736
6730
  });
6737
6731
  }
6738
6732
  let routeResult = result.routes[routeId];
6739
- if (!routeResult) {
6740
- return void 0;
6741
- } else if ("error" in routeResult) {
6733
+ invariant2(routeResult, `No response found for routeId "${routeId}"`);
6734
+ if ("error" in routeResult) {
6742
6735
  throw routeResult.error;
6743
6736
  } else if ("data" in routeResult) {
6744
6737
  return routeResult.data;
@@ -7982,7 +7975,7 @@ function mergeRefs(...refs) {
7982
7975
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7983
7976
  try {
7984
7977
  if (isBrowser) {
7985
- window.__reactRouterVersion = "0.0.0-experimental-573acd4d4";
7978
+ window.__reactRouterVersion = "0.0.0-experimental-856ae8c29";
7986
7979
  }
7987
7980
  } catch (e) {
7988
7981
  }
@@ -9685,7 +9678,7 @@ import { encode } from "turbo-stream";
9685
9678
 
9686
9679
  // lib/server-runtime/headers.ts
9687
9680
  import { splitCookiesString } from "set-cookie-parser";
9688
- function getDocumentHeaders(build, context) {
9681
+ function getDocumentHeaders(context, getRouteHeadersFn) {
9689
9682
  let boundaryIdx = context.errors ? context.matches.findIndex((m) => context.errors[m.route.id]) : -1;
9690
9683
  let matches = boundaryIdx >= 0 ? context.matches.slice(0, boundaryIdx + 1) : context.matches;
9691
9684
  let errorHeaders;
@@ -9703,14 +9696,12 @@ function getDocumentHeaders(build, context) {
9703
9696
  }
9704
9697
  return matches.reduce((parentHeaders, match, idx) => {
9705
9698
  let { id } = match.route;
9706
- let route = build.routes[id];
9707
- invariant3(route, `Route with id "${id}" not found in build`);
9708
- let routeModule = route.module;
9709
9699
  let loaderHeaders = context.loaderHeaders[id] || new Headers();
9710
9700
  let actionHeaders = context.actionHeaders[id] || new Headers();
9711
9701
  let includeErrorHeaders = errorHeaders != null && idx === matches.length - 1;
9712
9702
  let includeErrorCookies = includeErrorHeaders && errorHeaders !== loaderHeaders && errorHeaders !== actionHeaders;
9713
- if (routeModule.headers == null) {
9703
+ let headersFn = getRouteHeadersFn(match);
9704
+ if (headersFn == null) {
9714
9705
  let headers2 = new Headers(parentHeaders);
9715
9706
  if (includeErrorCookies) {
9716
9707
  prependCookies(errorHeaders, headers2);
@@ -9720,12 +9711,12 @@ function getDocumentHeaders(build, context) {
9720
9711
  return headers2;
9721
9712
  }
9722
9713
  let headers = new Headers(
9723
- routeModule.headers ? typeof routeModule.headers === "function" ? routeModule.headers({
9714
+ typeof headersFn === "function" ? headersFn({
9724
9715
  loaderHeaders,
9725
9716
  parentHeaders,
9726
9717
  actionHeaders,
9727
9718
  errorHeaders: includeErrorHeaders ? errorHeaders : void 0
9728
- }) : routeModule.headers : void 0
9719
+ }) : headersFn
9729
9720
  );
9730
9721
  if (includeErrorCookies) {
9731
9722
  prependCookies(errorHeaders, headers);
@@ -9758,7 +9749,10 @@ var SERVER_NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([
9758
9749
  async function singleFetchAction(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
9759
9750
  try {
9760
9751
  let respond2 = function(context) {
9761
- let headers = getDocumentHeaders(build, context);
9752
+ let headers = getDocumentHeaders(
9753
+ context,
9754
+ (m) => build.routes[m.route.id]?.module.headers
9755
+ );
9762
9756
  if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
9763
9757
  return generateSingleFetchResponse(request, build, serverMode, {
9764
9758
  result: getSingleFetchRedirect(
@@ -9833,7 +9827,10 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
9833
9827
  async function singleFetchLoaders(build, serverMode, staticHandler, request, handlerUrl, loadContext, handleError) {
9834
9828
  try {
9835
9829
  let respond2 = function(context) {
9836
- let headers = getDocumentHeaders(build, context);
9830
+ let headers = getDocumentHeaders(
9831
+ context,
9832
+ (m) => build.routes[m.route.id]?.module.headers
9833
+ );
9837
9834
  if (isRedirectStatusCode(context.statusCode) && headers.has("Location")) {
9838
9835
  return generateSingleFetchResponse(request, build, serverMode, {
9839
9836
  result: {
@@ -10296,7 +10293,10 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10296
10293
  if (isResponse(context)) {
10297
10294
  return context;
10298
10295
  }
10299
- let headers = getDocumentHeaders(build, context);
10296
+ let headers = getDocumentHeaders(
10297
+ context,
10298
+ (m) => build.routes[m.route.id]?.module.headers
10299
+ );
10300
10300
  if (SERVER_NO_BODY_STATUS_CODES.has(context.statusCode)) {
10301
10301
  return new Response(null, { status: context.statusCode, headers });
10302
10302
  }
@@ -10634,42 +10634,8 @@ function href(path, ...args) {
10634
10634
  }).filter((segment) => segment !== void 0).join("/");
10635
10635
  }
10636
10636
 
10637
- // lib/dom/ssr/errors.ts
10638
- function deserializeErrors2(errors) {
10639
- if (!errors) return null;
10640
- let entries = Object.entries(errors);
10641
- let serialized = {};
10642
- for (let [key, val] of entries) {
10643
- if (val && val.__type === "RouteErrorResponse") {
10644
- serialized[key] = new ErrorResponseImpl(
10645
- val.status,
10646
- val.statusText,
10647
- val.data,
10648
- val.internal === true
10649
- );
10650
- } else if (val && val.__type === "Error") {
10651
- if (val.__subType) {
10652
- let ErrorConstructor = window[val.__subType];
10653
- if (typeof ErrorConstructor === "function") {
10654
- try {
10655
- let error = new ErrorConstructor(val.message);
10656
- error.stack = val.stack;
10657
- serialized[key] = error;
10658
- } catch (e) {
10659
- }
10660
- }
10661
- }
10662
- if (serialized[key] == null) {
10663
- let error = new Error(val.message);
10664
- error.stack = val.stack;
10665
- serialized[key] = error;
10666
- }
10667
- } else {
10668
- serialized[key] = val;
10669
- }
10670
- }
10671
- return serialized;
10672
- }
10637
+ // lib/rsc/browser.tsx
10638
+ import * as React14 from "react";
10673
10639
 
10674
10640
  // lib/dom/ssr/hydration.tsx
10675
10641
  function getHydrationData(state, routes, getRouteInfo, location2, basename, isSpaMode) {
@@ -10697,8 +10663,7 @@ function getHydrationData(state, routes, getRouteInfo, location2, basename, isSp
10697
10663
  return hydrationData;
10698
10664
  }
10699
10665
 
10700
- // lib/server.browser.tsx
10701
- import * as React14 from "react";
10666
+ // lib/rsc/browser.tsx
10702
10667
  function createCallServer({
10703
10668
  decode: decode2,
10704
10669
  encodeAction
@@ -10774,7 +10739,7 @@ function createRouterFromPayload({
10774
10739
  if (window.__router) return window.__router;
10775
10740
  if (payload.type !== "render") throw new Error("Invalid payload type");
10776
10741
  let patches = /* @__PURE__ */ new Map();
10777
- payload.patches.forEach((patch) => {
10742
+ payload.patches?.forEach((patch) => {
10778
10743
  invariant(patch.parentId, "Invalid patch parentId");
10779
10744
  if (!patches.has(patch.parentId)) {
10780
10745
  patches.set(patch.parentId, []);
@@ -10951,7 +10916,7 @@ function getFetchAndDecodeViaRSC(decode2) {
10951
10916
  }
10952
10917
  };
10953
10918
  }
10954
- function ServerBrowserRouter({
10919
+ function RSCHydratedRouter({
10955
10920
  decode: decode2,
10956
10921
  payload
10957
10922
  }) {
@@ -10969,7 +10934,8 @@ function ServerBrowserRouter({
10969
10934
  }, []);
10970
10935
  const frameworkContext = {
10971
10936
  future: {
10972
- // TODO: Update these
10937
+ // These flags have no runtime impact so can always be false. If we add
10938
+ // flags that drive runtime behavior they'll need to be proxied through.
10973
10939
  unstable_middleware: false,
10974
10940
  unstable_subResourceIntegrity: false
10975
10941
  },
@@ -10977,11 +10943,7 @@ function ServerBrowserRouter({
10977
10943
  ssr: true,
10978
10944
  criticalCss: "",
10979
10945
  manifest: {
10980
- routes: {
10981
- // root: {
10982
- // css: []
10983
- // },
10984
- },
10946
+ routes: {},
10985
10947
  version: "1",
10986
10948
  url: "",
10987
10949
  entry: {
@@ -11081,10 +11043,10 @@ function preventInvalidServerHandlerCall2(type, routeId, hasHandler) {
11081
11043
  }
11082
11044
  }
11083
11045
 
11084
- // lib/server.static.tsx
11046
+ // lib/rsc/server.ssr.tsx
11085
11047
  import * as React15 from "react";
11086
11048
 
11087
- // lib/html-stream/server.ts
11049
+ // lib/rsc/html-stream/server.ts
11088
11050
  var encoder2 = new TextEncoder();
11089
11051
  var trailer = "</body></html>";
11090
11052
  function injectRSCPayload(rscStream) {
@@ -11172,8 +11134,8 @@ function escapeScript(script) {
11172
11134
  return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
11173
11135
  }
11174
11136
 
11175
- // lib/server.static.tsx
11176
- async function routeServerRequest(request, requestServer, decode2, renderHTML) {
11137
+ // lib/rsc/server.ssr.tsx
11138
+ async function routeRSCServerRequest(request, requestServer, decode2, renderHTML) {
11177
11139
  const url = new URL(request.url);
11178
11140
  let serverRequest = request;
11179
11141
  const isDataRequest = isReactServerRequest(url);
@@ -11181,13 +11143,12 @@ async function routeServerRequest(request, requestServer, decode2, renderHTML) {
11181
11143
  if (isDataRequest) {
11182
11144
  const serverURL = new URL(request.url);
11183
11145
  serverURL.pathname = serverURL.pathname.replace(/(_root)?\.rsc$/, "");
11184
- if (!isDataRequest) {
11185
- serverURL.searchParams.delete("_routes");
11186
- }
11146
+ let headers = new Headers(request.headers);
11147
+ headers.set("X-React-Router-Data-Request", "true");
11187
11148
  serverRequest = new Request(serverURL, {
11188
11149
  body: request.body,
11189
11150
  duplex: request.body ? "half" : void 0,
11190
- headers: request.headers,
11151
+ headers,
11191
11152
  method: request.method,
11192
11153
  signal: request.signal
11193
11154
  });
@@ -11225,7 +11186,7 @@ async function routeServerRequest(request, requestServer, decode2, renderHTML) {
11225
11186
  throw reason;
11226
11187
  }
11227
11188
  }
11228
- function ServerStaticRouter({ payload }) {
11189
+ function RSCStaticRouter({ payload }) {
11229
11190
  if (payload.type !== "render") return null;
11230
11191
  const context = {
11231
11192
  actionData: payload.actionData,
@@ -11276,7 +11237,8 @@ function ServerStaticRouter({ payload }) {
11276
11237
  );
11277
11238
  const frameworkContext = {
11278
11239
  future: {
11279
- // TODO: Update these
11240
+ // These flags have no runtime impact so can always be false. If we add
11241
+ // flags that drive runtime behavior they'll need to be proxied through.
11280
11242
  unstable_middleware: false,
11281
11243
  unstable_subResourceIntegrity: false
11282
11244
  },
@@ -11284,11 +11246,7 @@ function ServerStaticRouter({ payload }) {
11284
11246
  ssr: true,
11285
11247
  criticalCss: "",
11286
11248
  manifest: {
11287
- routes: {
11288
- // root: {
11289
- // css: []
11290
- // },
11291
- },
11249
+ routes: {},
11292
11250
  version: "1",
11293
11251
  url: "",
11294
11252
  entry: {
@@ -11315,7 +11273,7 @@ function isManifestRequest(url) {
11315
11273
  return url.pathname.endsWith(".manifest");
11316
11274
  }
11317
11275
 
11318
- // lib/html-stream/browser.ts
11276
+ // lib/rsc/html-stream/browser.ts
11319
11277
  function getServerStream() {
11320
11278
  let encoder3 = new TextEncoder();
11321
11279
  let streamController = null;
@@ -11350,6 +11308,43 @@ function getServerStream() {
11350
11308
  return rscStream;
11351
11309
  }
11352
11310
 
11311
+ // lib/dom/ssr/errors.ts
11312
+ function deserializeErrors2(errors) {
11313
+ if (!errors) return null;
11314
+ let entries = Object.entries(errors);
11315
+ let serialized = {};
11316
+ for (let [key, val] of entries) {
11317
+ if (val && val.__type === "RouteErrorResponse") {
11318
+ serialized[key] = new ErrorResponseImpl(
11319
+ val.status,
11320
+ val.statusText,
11321
+ val.data,
11322
+ val.internal === true
11323
+ );
11324
+ } else if (val && val.__type === "Error") {
11325
+ if (val.__subType) {
11326
+ let ErrorConstructor = window[val.__subType];
11327
+ if (typeof ErrorConstructor === "function") {
11328
+ try {
11329
+ let error = new ErrorConstructor(val.message);
11330
+ error.stack = val.stack;
11331
+ serialized[key] = error;
11332
+ } catch (e) {
11333
+ }
11334
+ }
11335
+ }
11336
+ if (serialized[key] == null) {
11337
+ let error = new Error(val.message);
11338
+ error.stack = val.stack;
11339
+ serialized[key] = error;
11340
+ }
11341
+ } else {
11342
+ serialized[key] = val;
11343
+ }
11344
+ }
11345
+ return serialized;
11346
+ }
11347
+
11353
11348
  export {
11354
11349
  Action,
11355
11350
  createBrowserHistory,
@@ -11465,12 +11460,11 @@ export {
11465
11460
  createCookieSessionStorage,
11466
11461
  createMemorySessionStorage,
11467
11462
  href,
11468
- deserializeErrors2 as deserializeErrors,
11469
11463
  getHydrationData,
11470
11464
  createCallServer,
11471
- ServerBrowserRouter,
11472
- routeServerRequest,
11473
- ServerStaticRouter,
11474
- isReactServerRequest,
11475
- getServerStream
11465
+ RSCHydratedRouter,
11466
+ routeRSCServerRequest,
11467
+ RSCStaticRouter,
11468
+ getServerStream,
11469
+ deserializeErrors2 as deserializeErrors
11476
11470
  };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './browser-B_fyLsf9.mjs';
3
- import { R as RouterInit } from './route-data-DX3MskAN.mjs';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-DwsWwUlp.mjs';
3
+ import { R as RouterInit } from './route-data-BIYebJr3.mjs';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './browser-Dpxu0wdb.js';
3
- import { R as RouterInit } from './route-data-DX3MskAN.js';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-BHTxbJsu.js';
3
+ import { R as RouterInit } from './route-data-BIYebJr3.js';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-573acd4d4
2
+ * react-router v0.0.0-experimental-856ae8c29
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -993,7 +993,14 @@ function createRouter(init) {
993
993
  if (newState.matches) {
994
994
  newState.matches = newState.matches.map((m) => {
995
995
  let route = manifest[m.route.id];
996
- return { ...m, route };
996
+ let matchRoute = m.route;
997
+ if (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) {
998
+ return {
999
+ ...m,
1000
+ route
1001
+ };
1002
+ }
1003
+ return m;
997
1004
  });
998
1005
  }
999
1006
  state = {
@@ -2886,7 +2893,7 @@ function shouldRevalidateLoader(loaderMatch, arg) {
2886
2893
  function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRouteProperties2, allowElementMutations) {
2887
2894
  let childrenToPatch;
2888
2895
  if (routeId) {
2889
- let route = findRouteRecursively(routeId, routesToUse);
2896
+ let route = manifest[routeId];
2890
2897
  invariant(
2891
2898
  route,
2892
2899
  `No route found to patch children into: routeId = ${routeId}`
@@ -2922,19 +2929,20 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
2922
2929
  if (allowElementMutations && existingChildren.length > 0) {
2923
2930
  for (let i = 0; i < existingChildren.length; i++) {
2924
2931
  let { existingRoute, newRoute } = existingChildren[i];
2925
- let existingRouteAny = existingRoute;
2926
- let [newRouteAny] = convertRoutesToDataRoutes(
2932
+ let existingRouteTyped = existingRoute;
2933
+ let [newRouteTyped] = convertRoutesToDataRoutes(
2927
2934
  [newRoute],
2928
2935
  mapRouteProperties2,
2929
2936
  [],
2930
2937
  // Doesn't matter for mutated routes since they already have an id
2931
- manifest,
2938
+ {},
2939
+ // Don't touch the manifest here since we're updating in place
2932
2940
  true
2933
2941
  );
2934
- Object.assign(existingRouteAny, {
2935
- element: newRouteAny.element ? newRouteAny.element : existingRouteAny.element,
2936
- errorElement: newRouteAny.errorElement ? newRouteAny.errorElement : existingRouteAny.errorElement,
2937
- hydrateFallbackElement: newRouteAny.hydrateFallbackElement ? newRouteAny.hydrateFallbackElement : existingRouteAny.hydrateFallbackElement
2942
+ Object.assign(existingRouteTyped, {
2943
+ element: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element,
2944
+ errorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement,
2945
+ hydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement
2938
2946
  });
2939
2947
  }
2940
2948
  }
@@ -2953,20 +2961,6 @@ function isSameRoute(newRoute, existingRoute) {
2953
2961
  (aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))
2954
2962
  );
2955
2963
  }
2956
- function findRouteRecursively(id, routes) {
2957
- for (const route of routes) {
2958
- if (route.id === id) {
2959
- return route;
2960
- }
2961
- if (route.children) {
2962
- const found = findRouteRecursively(id, route.children);
2963
- if (found) {
2964
- return found;
2965
- }
2966
- }
2967
- }
2968
- return null;
2969
- }
2970
2964
  var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
2971
2965
  var loadLazyRouteProperty = ({
2972
2966
  key,
@@ -5193,9 +5187,8 @@ function unwrapSingleFetchResult(result, routeId) {
5193
5187
  });
5194
5188
  }
5195
5189
  let routeResult = result.routes[routeId];
5196
- if (!routeResult) {
5197
- return void 0;
5198
- } else if ("error" in routeResult) {
5190
+ invariant2(routeResult, `No response found for routeId "${routeId}"`);
5191
+ if ("error" in routeResult) {
5199
5192
  throw routeResult.error;
5200
5193
  } else if ("data" in routeResult) {
5201
5194
  return routeResult.data;
@@ -6091,6 +6084,32 @@ function dedupe(array) {
6091
6084
  return [...new Set(array)];
6092
6085
  }
6093
6086
 
6087
+ // lib/dom/ssr/hydration.tsx
6088
+ function getHydrationData(state, routes, getRouteInfo, location, basename, isSpaMode) {
6089
+ let hydrationData = {
6090
+ ...state,
6091
+ loaderData: { ...state.loaderData }
6092
+ };
6093
+ let initialMatches = matchRoutes(routes, location, basename);
6094
+ if (initialMatches) {
6095
+ for (let match of initialMatches) {
6096
+ let routeId = match.route.id;
6097
+ let routeInfo = getRouteInfo(routeId);
6098
+ if (shouldHydrateRouteLoader(
6099
+ routeId,
6100
+ routeInfo.clientLoader,
6101
+ routeInfo.hasLoader,
6102
+ isSpaMode
6103
+ ) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
6104
+ delete hydrationData.loaderData[routeId];
6105
+ } else if (!routeInfo.hasLoader) {
6106
+ hydrationData.loaderData[routeId] = null;
6107
+ }
6108
+ }
6109
+ }
6110
+ return hydrationData;
6111
+ }
6112
+
6094
6113
  // lib/dom/ssr/errors.ts
6095
6114
  function deserializeErrors(errors) {
6096
6115
  if (!errors) return null;
@@ -6128,32 +6147,6 @@ function deserializeErrors(errors) {
6128
6147
  return serialized;
6129
6148
  }
6130
6149
 
6131
- // lib/dom/ssr/hydration.tsx
6132
- function getHydrationData(state, routes, getRouteInfo, location, basename, isSpaMode) {
6133
- let hydrationData = {
6134
- ...state,
6135
- loaderData: { ...state.loaderData }
6136
- };
6137
- let initialMatches = matchRoutes(routes, location, basename);
6138
- if (initialMatches) {
6139
- for (let match of initialMatches) {
6140
- let routeId = match.route.id;
6141
- let routeInfo = getRouteInfo(routeId);
6142
- if (shouldHydrateRouteLoader(
6143
- routeId,
6144
- routeInfo.clientLoader,
6145
- routeInfo.hasLoader,
6146
- isSpaMode
6147
- ) && (routeInfo.hasHydrateFallback || !routeInfo.hasLoader)) {
6148
- delete hydrationData.loaderData[routeId];
6149
- } else if (!routeInfo.hasLoader) {
6150
- hydrationData.loaderData[routeId] = null;
6151
- }
6152
- }
6153
- }
6154
- return hydrationData;
6155
- }
6156
-
6157
6150
  // lib/dom-export/dom-router-provider.tsx
6158
6151
  function RouterProvider2(props) {
6159
6152
  return /* @__PURE__ */ React10.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-573acd4d4
2
+ * react-router v0.0.0-experimental-856ae8c29
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -25,7 +25,7 @@ import {
25
25
  invariant,
26
26
  mapRouteProperties,
27
27
  useFogOFWarDiscovery
28
- } from "./chunk-6DVU7PCU.mjs";
28
+ } from "./chunk-SFY5YCQ7.mjs";
29
29
 
30
30
  // lib/dom-export/dom-router-provider.tsx
31
31
  import * as React from "react";
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { k as RouteObject, R as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, at as PatchRoutesOnNavigationFunction, a as Router$1, T as To, d as RelativeRoutingType, y as NonIndexRouteObject, a5 as LazyRouteFunction, s as IndexRouteObject, e as Location, f as Action, as as Navigator, av as RouteMatch, p as StaticHandlerContext, c as RouteManifest, b as RouteModules, G as DataRouteObject, J as ClientLoaderFunction, a4 as HTMLFormMethod, a2 as FormEncType, aD as PageLinkDescriptor, aT as History, O as GetScrollRestorationKeyFunction, N as NavigateOptions, Q as Fetcher, n as SerializeFrom, B as BlockerFunction, aw as ClientActionFunction, x as LinksFunction, w as MetaFunction, aa as ShouldRevalidateFunction, j as Params } from './route-data-DX3MskAN.js';
2
+ import { k as RouteObject, R as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, at as PatchRoutesOnNavigationFunction, a as Router$1, T as To, d as RelativeRoutingType, y as NonIndexRouteObject, a5 as LazyRouteFunction, s as IndexRouteObject, e as Location, f as Action, as as Navigator, av as RouteMatch, p as StaticHandlerContext, c as RouteManifest, b as RouteModules, G as DataRouteObject, J as ClientLoaderFunction, a4 as HTMLFormMethod, a2 as FormEncType, aD as PageLinkDescriptor, aT as History, O as GetScrollRestorationKeyFunction, N as NavigateOptions, Q as Fetcher, n as SerializeFrom, B as BlockerFunction, aw as ClientActionFunction, x as LinksFunction, w as MetaFunction, aa as ShouldRevalidateFunction, j as Params } from './route-data-BIYebJr3.js';
3
3
 
4
4
  /**
5
5
  * @private
@@ -1678,16 +1678,6 @@ declare function useViewTransitionState(to: To, opts?: {
1678
1678
  relative?: RelativeRoutingType;
1679
1679
  }): boolean;
1680
1680
 
1681
- declare global {
1682
- interface Navigator {
1683
- connection?: {
1684
- saveData: boolean;
1685
- };
1686
- }
1687
- }
1688
- declare function getPatchRoutesOnNavigationFunction(manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, isSpaMode: boolean, basename: string | undefined): PatchRoutesOnNavigationFunction | undefined;
1689
- declare function useFogOFWarDiscovery(router: Router$1, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, isSpaMode: boolean): void;
1690
-
1691
1681
  type RenderedRoute = {
1692
1682
  clientAction?: ClientActionFunction;
1693
1683
  clientLoader?: ClientLoaderFunction;
@@ -1719,7 +1709,7 @@ type ServerRenderPayload = {
1719
1709
  loaderData: Record<string, any>;
1720
1710
  location: Location;
1721
1711
  matches: ServerRouteMatch[];
1722
- patches: RenderedRoute[];
1712
+ patches?: RenderedRoute[];
1723
1713
  nonce?: string;
1724
1714
  };
1725
1715
  type ServerManifestPayload = {
@@ -1754,7 +1744,7 @@ declare function createCallServer({ decode, encodeAction, }: {
1754
1744
  decode: DecodeServerResponseFunction;
1755
1745
  encodeAction: EncodeActionFunction;
1756
1746
  }): (id: string, args: unknown[]) => Promise<unknown>;
1757
- declare function ServerBrowserRouter({ decode, payload, }: {
1747
+ declare function RSCHydratedRouter({ decode, payload, }: {
1758
1748
  decode: DecodeServerResponseFunction;
1759
1749
  payload: ServerPayload;
1760
1750
  }): React.JSX.Element;
@@ -1766,4 +1756,14 @@ declare global {
1766
1756
  }
1767
1757
  declare function getServerStream(): ReadableStream<any>;
1768
1758
 
1769
- export { useLinkClickHandler as $, type AssetsManifest as A, type BrowserRouterProps as B, type CriticalCss as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type SubmitFunction as G, type HashRouterProps as H, type IndexRouteProps as I, type FetcherSubmitFunction as J, type FetcherWithComponents as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, createBrowserRouter as Q, type RouterProviderProps as R, type ServerPayload as S, createHashRouter as T, BrowserRouter as U, HashRouter as V, Link as W, HistoryRouter as X, NavLink as Y, Form as Z, ScrollRestoration as _, type Route as a, useSearchParams as a0, useSubmit as a1, useFormAction as a2, useFetcher as a3, useFetchers as a4, useBeforeUnload as a5, usePrompt as a6, useViewTransitionState as a7, type FetcherSubmitOptions as a8, type ParamKeyValuePair as a9, type SubmitOptions as aa, type URLSearchParamsInit as ab, type SubmitTarget as ac, createSearchParams as ad, Meta as ae, Links as af, Scripts as ag, PrefetchPageLinks as ah, type ScriptsProps as ai, hydrationRouteProperties as aj, mapRouteProperties as ak, FrameworkContext as al, getPatchRoutesOnNavigationFunction as am, useFogOFWarDiscovery as an, createClientRoutes as ao, createClientRoutesWithHMRRevalidationOptOut as ap, shouldHydrateRouteLoader as aq, useScrollRestoration as ar, type DecodeServerResponseFunction as as, type EncodeActionFunction as at, createCallServer as au, ServerBrowserRouter as av, getServerStream as aw, type AwaitProps as b, type MemoryRouterProps as c, type RouteProps as d, type RouterProps as e, type RoutesProps as f, Await as g, MemoryRouter as h, Navigate as i, Outlet as j, Route$1 as k, Router as l, RouterProvider as m, Routes as n, createMemoryRouter as o, createRoutesFromChildren as p, createRoutesFromElements as q, renderMatches as r, type HistoryRouterProps as s, type LinkProps as t, type NavLinkProps as u, type NavLinkRenderProps as v, type FetcherFormProps as w, type FormProps as x, type ScrollRestorationProps as y, type SetURLSearchParams as z };
1759
+ declare global {
1760
+ interface Navigator {
1761
+ connection?: {
1762
+ saveData: boolean;
1763
+ };
1764
+ }
1765
+ }
1766
+ declare function getPatchRoutesOnNavigationFunction(manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, isSpaMode: boolean, basename: string | undefined): PatchRoutesOnNavigationFunction | undefined;
1767
+ declare function useFogOFWarDiscovery(router: Router$1, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, isSpaMode: boolean): void;
1768
+
1769
+ export { useLinkClickHandler as $, type AssetsManifest as A, type BrowserRouterProps as B, type CriticalCss as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type SubmitFunction as G, type HashRouterProps as H, type IndexRouteProps as I, type FetcherSubmitFunction as J, type FetcherWithComponents as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateProps as N, type OutletProps as O, type PathRouteProps as P, createBrowserRouter as Q, type RouterProviderProps as R, type ServerPayload as S, createHashRouter as T, BrowserRouter as U, HashRouter as V, Link as W, HistoryRouter as X, NavLink as Y, Form as Z, ScrollRestoration as _, type Route as a, useSearchParams as a0, useSubmit as a1, useFormAction as a2, useFetcher as a3, useFetchers as a4, useBeforeUnload as a5, usePrompt as a6, useViewTransitionState as a7, type FetcherSubmitOptions as a8, type ParamKeyValuePair as a9, type SubmitOptions as aa, type URLSearchParamsInit as ab, type SubmitTarget as ac, createSearchParams as ad, Meta as ae, Links as af, Scripts as ag, PrefetchPageLinks as ah, type ScriptsProps as ai, type DecodeServerResponseFunction as aj, type EncodeActionFunction as ak, createCallServer as al, RSCHydratedRouter as am, getServerStream as an, hydrationRouteProperties as ao, mapRouteProperties as ap, FrameworkContext as aq, getPatchRoutesOnNavigationFunction as ar, useFogOFWarDiscovery as as, createClientRoutes as at, createClientRoutesWithHMRRevalidationOptOut as au, shouldHydrateRouteLoader as av, useScrollRestoration as aw, type AwaitProps as b, type MemoryRouterProps as c, type RouteProps as d, type RouterProps as e, type RoutesProps as f, Await as g, MemoryRouter as h, Navigate as i, Outlet as j, Route$1 as k, Router as l, RouterProvider as m, Routes as n, createMemoryRouter as o, createRoutesFromChildren as p, createRoutesFromElements as q, renderMatches as r, type HistoryRouterProps as s, type LinkProps as t, type NavLinkProps as u, type NavLinkRenderProps as v, type FetcherFormProps as w, type FormProps as x, type ScrollRestorationProps as y, type SetURLSearchParams as z };