react-router 7.9.6-pre.1 → 7.10.0-pre.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +69 -4
  2. package/dist/development/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
  3. package/dist/development/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
  4. package/dist/development/{chunk-HSVNPM3C.js → chunk-2VILFZWG.js} +167 -123
  5. package/dist/development/{chunk-DKSAHU2I.mjs → chunk-4BTFPFZR.mjs} +208 -221
  6. package/dist/development/{chunk-RGKEVI2W.mjs → chunk-CECIHG5K.mjs} +15 -5
  7. package/dist/development/{chunk-CYHICRRW.js → chunk-M4WLV5HP.js} +201 -258
  8. package/dist/development/{chunk-OLIKX45O.js → chunk-Z4R76DXJ.js} +7 -7
  9. package/dist/development/dom-export.d.mts +21 -2
  10. package/dist/development/dom-export.d.ts +21 -2
  11. package/dist/development/dom-export.js +158 -103
  12. package/dist/development/dom-export.mjs +133 -79
  13. package/dist/development/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
  14. package/dist/{production/index-react-server-client-rcoGPJhU.d.mts → development/index-react-server-client-DYtvZPLT.d.mts} +59 -7
  15. package/dist/development/index-react-server-client.d.mts +2 -2
  16. package/dist/development/index-react-server-client.d.ts +2 -2
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +19 -4
  20. package/dist/development/index-react-server.d.ts +19 -4
  21. package/dist/development/index-react-server.js +30 -24
  22. package/dist/development/index-react-server.mjs +30 -24
  23. package/dist/development/index.d.mts +19 -15
  24. package/dist/development/index.d.ts +19 -15
  25. package/dist/development/index.js +92 -82
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/{production/instrumentation-Unc20tLk.d.ts → development/instrumentation-Dwf-sTWa.d.ts} +66 -8
  28. package/dist/development/lib/types/internal.d.mts +2 -2
  29. package/dist/development/lib/types/internal.d.ts +2 -2
  30. package/dist/development/lib/types/internal.js +1 -1
  31. package/dist/development/lib/types/internal.mjs +1 -1
  32. package/dist/development/{register-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
  33. package/dist/development/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
  34. package/dist/development/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
  35. package/dist/production/{browser-C07r42Tt.d.mts → browser-BHySFrZ2.d.mts} +1 -1
  36. package/dist/production/{browser-BbBXFHbO.d.ts → browser-eL-tAN4R.d.ts} +1 -1
  37. package/dist/production/{chunk-2DNJUQK6.js → chunk-55FFLVQP.js} +201 -258
  38. package/dist/production/{chunk-EDK3MRM6.js → chunk-5DTJHKF7.js} +167 -123
  39. package/dist/production/{chunk-LESYMMDQ.mjs → chunk-KJ5676BZ.mjs} +208 -221
  40. package/dist/production/{chunk-LC2OWLJG.mjs → chunk-QKAGOFED.mjs} +15 -5
  41. package/dist/production/{chunk-JLDESRHY.js → chunk-SGCRBGEM.js} +7 -7
  42. package/dist/production/dom-export.d.mts +21 -2
  43. package/dist/production/dom-export.d.ts +21 -2
  44. package/dist/production/dom-export.js +158 -103
  45. package/dist/production/dom-export.mjs +133 -79
  46. package/dist/production/{index-react-server-client-Da3kmxNd.d.ts → index-react-server-client-CNrKUHDv.d.ts} +59 -7
  47. package/dist/{development/index-react-server-client-rcoGPJhU.d.mts → production/index-react-server-client-DYtvZPLT.d.mts} +59 -7
  48. package/dist/production/index-react-server-client.d.mts +2 -2
  49. package/dist/production/index-react-server-client.d.ts +2 -2
  50. package/dist/production/index-react-server-client.js +4 -4
  51. package/dist/production/index-react-server-client.mjs +2 -2
  52. package/dist/production/index-react-server.d.mts +19 -4
  53. package/dist/production/index-react-server.d.ts +19 -4
  54. package/dist/production/index-react-server.js +30 -24
  55. package/dist/production/index-react-server.mjs +30 -24
  56. package/dist/production/index.d.mts +19 -15
  57. package/dist/production/index.d.ts +19 -15
  58. package/dist/production/index.js +92 -82
  59. package/dist/production/index.mjs +3 -3
  60. package/dist/{development/instrumentation-Unc20tLk.d.ts → production/instrumentation-Dwf-sTWa.d.ts} +66 -8
  61. package/dist/production/lib/types/internal.d.mts +2 -2
  62. package/dist/production/lib/types/internal.d.ts +2 -2
  63. package/dist/production/lib/types/internal.js +1 -1
  64. package/dist/production/lib/types/internal.mjs +1 -1
  65. package/dist/production/{register-BpU9rFBJ.d.ts → register-BnQsYkwj.d.ts} +1 -1
  66. package/dist/production/{register-QkB3HGjm.d.mts → register-C97Jz2jB.d.mts} +1 -1
  67. package/dist/production/{router-CAvh_Drx.d.mts → router-Dgz_Mh9m.d.mts} +66 -8
  68. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
2
- * react-router v7.9.6-pre.1
2
+ * react-router v7.10.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- var _chunkCYHICRRWjs = require('./chunk-CYHICRRW.js');
17
+ var _chunkM4WLV5HPjs = require('./chunk-M4WLV5HP.js');
18
18
 
19
19
  // lib/dom/ssr/hydration.tsx
20
20
  function getHydrationData({
@@ -29,12 +29,12 @@ function getHydrationData({
29
29
  ...state,
30
30
  loaderData: { ...state.loaderData }
31
31
  };
32
- let initialMatches = _chunkCYHICRRWjs.matchRoutes.call(void 0, routes, location, basename);
32
+ let initialMatches = _chunkM4WLV5HPjs.matchRoutes.call(void 0, routes, location, basename);
33
33
  if (initialMatches) {
34
34
  for (let match of initialMatches) {
35
35
  let routeId = match.route.id;
36
36
  let routeInfo = getRouteInfo(routeId);
37
- if (_chunkCYHICRRWjs.shouldHydrateRouteLoader.call(void 0,
37
+ if (_chunkM4WLV5HPjs.shouldHydrateRouteLoader.call(void 0,
38
38
  routeId,
39
39
  routeInfo.clientLoader,
40
40
  routeInfo.hasLoader,
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
112
112
  }
113
113
  }
114
114
  );
115
- if (_chunkCYHICRRWjs.isRouteErrorResponse.call(void 0, error)) {
115
+ if (_chunkM4WLV5HPjs.isRouteErrorResponse.call(void 0, error)) {
116
116
  return /* @__PURE__ */ _react2.default.createElement(
117
117
  ErrorWrapper,
118
118
  {
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
120
120
  title: "Unhandled Thrown Response!"
121
121
  },
122
122
  /* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
123
- _chunkCYHICRRWjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
123
+ _chunkM4WLV5HPjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
124
124
  );
125
125
  }
126
126
  let errorInstance;
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
146
146
  function RSCDefaultRootErrorBoundary({
147
147
  hasRootLayout
148
148
  }) {
149
- let error = _chunkCYHICRRWjs.useRouteError.call(void 0, );
149
+ let error = _chunkM4WLV5HPjs.useRouteError.call(void 0, );
150
150
  if (hasRootLayout === void 0) {
151
151
  throw new Error("Missing 'hasRootLayout' prop");
152
152
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-CAvh_Drx.mjs';
3
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-C07r42Tt.mjs';
2
+ import { f as RouterProviderProps$1, e as RouterInit, u as unstable_ClientInstrumentation, g as unstable_ClientOnErrorFunction } from './router-Dgz_Mh9m.mjs';
3
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BHySFrZ2.mjs';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -88,6 +88,25 @@ interface HydratedRouterProps {
88
88
  * ```
89
89
  */
90
90
  unstable_onError?: unstable_ClientOnErrorFunction;
91
+ /**
92
+ * Control whether router state updates are internally wrapped in
93
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
94
+ *
95
+ * - When left `undefined`, all state updates are wrapped in
96
+ * `React.startTransition`
97
+ * - This can lead to buggy behaviors if you are wrapping your own
98
+ * navigations/fetchers in `startTransition`.
99
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
100
+ * in `React.startTransition` and router state changes will be wrapped in
101
+ * `React.startTransition` and also sent through
102
+ * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
103
+ * surface mid-navigation router state changes to the UI.
104
+ * - When set to `false`, the router will not leverage `React.startTransition` or
105
+ * `React.useOptimistic` on any navigations or state changes.
106
+ *
107
+ * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
108
+ */
109
+ unstable_useTransitions?: boolean;
91
110
  }
92
111
  /**
93
112
  * Framework-mode router component to be used to hydrate a router from a
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { RouterProviderProps as RouterProviderProps$1, RouterInit, unstable_ClientOnErrorFunction } from 'react-router';
3
- import { u as unstable_ClientInstrumentation } from './instrumentation-Unc20tLk.js';
4
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BbBXFHbO.js';
3
+ import { u as unstable_ClientInstrumentation } from './instrumentation-Dwf-sTWa.js';
4
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-eL-tAN4R.js';
5
5
 
6
6
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
7
7
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -89,6 +89,25 @@ interface HydratedRouterProps {
89
89
  * ```
90
90
  */
91
91
  unstable_onError?: unstable_ClientOnErrorFunction;
92
+ /**
93
+ * Control whether router state updates are internally wrapped in
94
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
95
+ *
96
+ * - When left `undefined`, all state updates are wrapped in
97
+ * `React.startTransition`
98
+ * - This can lead to buggy behaviors if you are wrapping your own
99
+ * navigations/fetchers in `startTransition`.
100
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
101
+ * in `React.startTransition` and router state changes will be wrapped in
102
+ * `React.startTransition` and also sent through
103
+ * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
104
+ * surface mid-navigation router state changes to the UI.
105
+ * - When set to `false`, the router will not leverage `React.startTransition` or
106
+ * `React.useOptimistic` on any navigations or state changes.
107
+ *
108
+ * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
109
+ */
110
+ unstable_useTransitions?: boolean;
92
111
  }
93
112
  /**
94
113
  * Framework-mode router component to be used to hydrate a router from a
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.9.6-pre.1
2
+ * react-router v7.10.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunkOLIKX45Ojs = require('./chunk-OLIKX45O.js');
16
+ var _chunkZ4R76DXJjs = require('./chunk-Z4R76DXJ.js');
17
17
 
18
18
 
19
19
 
@@ -32,13 +32,13 @@ var _chunkOLIKX45Ojs = require('./chunk-OLIKX45O.js');
32
32
 
33
33
 
34
34
 
35
- var _chunkCYHICRRWjs = require('./chunk-CYHICRRW.js');
35
+ var _chunkM4WLV5HPjs = require('./chunk-M4WLV5HP.js');
36
36
 
37
37
  // lib/dom-export/dom-router-provider.tsx
38
38
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
39
39
  var _reactdom = require('react-dom'); var ReactDOM = _interopRequireWildcard(_reactdom); var ReactDOM2 = _interopRequireWildcard(_reactdom);
40
40
  var _reactrouter = require('react-router');
41
- function RouterProvider(props) {
41
+ function RouterProvider2(props) {
42
42
  return /* @__PURE__ */ React.createElement(_reactrouter.RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
43
43
  }
44
44
 
@@ -204,7 +204,7 @@ function HydratedRouter(props) {
204
204
  }, []);
205
205
  React2.useEffect(() => {
206
206
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
207
- document.querySelectorAll(`[${_chunkCYHICRRWjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
207
+ document.querySelectorAll(`[${_chunkM4WLV5HPjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
208
208
  }
209
209
  }, [criticalCss]);
210
210
  let [location2, setLocation] = React2.useState(router.state.location);
@@ -249,9 +249,10 @@ function HydratedRouter(props) {
249
249
  }
250
250
  },
251
251
  /* @__PURE__ */ React2.createElement(_reactrouter.UNSAFE_RemixErrorBoundary, { location: location2 }, /* @__PURE__ */ React2.createElement(
252
- RouterProvider,
252
+ RouterProvider2,
253
253
  {
254
254
  router,
255
+ unstable_useTransitions: props.unstable_useTransitions,
255
256
  unstable_onError: props.unstable_onError
256
257
  }
257
258
  ))
@@ -290,66 +291,68 @@ function createCallServer({
290
291
  temporaryReferences
291
292
  });
292
293
  });
293
- globalVar.__reactRouterDataRouter.__setPendingRerender(
294
- Promise.resolve(payloadPromise).then(async (payload) => {
295
- if (payload.type === "redirect") {
296
- if (payload.reload || isExternalLocation(payload.location)) {
297
- window.location.href = payload.location;
298
- return () => {
299
- };
300
- }
301
- return () => {
302
- globalVar.__reactRouterDataRouter.navigate(payload.location, {
303
- replace: payload.replace
304
- });
305
- };
306
- }
307
- if (payload.type !== "action") {
308
- throw new Error("Unexpected payload type");
309
- }
310
- const rerender = await payload.rerender;
311
- if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
312
- if (rerender.type === "redirect") {
313
- if (rerender.reload || isExternalLocation(rerender.location)) {
314
- window.location.href = rerender.location;
294
+ React3.startTransition(
295
+ () => (
296
+ // @ts-expect-error - Needs React 19 types
297
+ Promise.resolve(payloadPromise).then(async (payload) => {
298
+ if (payload.type === "redirect") {
299
+ if (payload.reload || isExternalLocation(payload.location)) {
300
+ window.location.href = payload.location;
315
301
  return;
316
302
  }
317
- return () => {
318
- globalVar.__reactRouterDataRouter.navigate(rerender.location, {
319
- replace: rerender.replace
303
+ React3.startTransition(() => {
304
+ globalVar.__reactRouterDataRouter.navigate(payload.location, {
305
+ replace: payload.replace
320
306
  });
321
- };
307
+ });
308
+ return;
322
309
  }
323
- return () => {
324
- let lastMatch;
325
- for (const match of rerender.matches) {
326
- globalVar.__reactRouterDataRouter.patchRoutes(
327
- _nullishCoalesce(_optionalChain([lastMatch, 'optionalAccess', _21 => _21.id]), () => ( null)),
328
- [createRouteFromServerManifest(match)],
329
- true
330
- );
331
- lastMatch = match;
310
+ if (payload.type !== "action") {
311
+ throw new Error("Unexpected payload type");
312
+ }
313
+ const rerender = await payload.rerender;
314
+ if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
315
+ if (rerender.type === "redirect") {
316
+ if (rerender.reload || isExternalLocation(rerender.location)) {
317
+ window.location.href = rerender.location;
318
+ return;
319
+ }
320
+ React3.startTransition(() => {
321
+ globalVar.__reactRouterDataRouter.navigate(rerender.location, {
322
+ replace: rerender.replace
323
+ });
324
+ });
325
+ return;
332
326
  }
333
- window.__reactRouterDataRouter._internalSetStateDoNotUseOrYouWillBreakYourApp(
334
- {
335
- loaderData: Object.assign(
336
- {},
337
- globalVar.__reactRouterDataRouter.state.loaderData,
338
- rerender.loaderData
339
- ),
340
- errors: rerender.errors ? Object.assign(
341
- {},
342
- globalVar.__reactRouterDataRouter.state.errors,
343
- rerender.errors
344
- ) : null
327
+ React3.startTransition(() => {
328
+ let lastMatch;
329
+ for (const match of rerender.matches) {
330
+ globalVar.__reactRouterDataRouter.patchRoutes(
331
+ _nullishCoalesce(_optionalChain([lastMatch, 'optionalAccess', _21 => _21.id]), () => ( null)),
332
+ [createRouteFromServerManifest(match)],
333
+ true
334
+ );
335
+ lastMatch = match;
345
336
  }
346
- );
347
- };
348
- }
349
- return () => {
350
- };
351
- }).catch(() => {
352
- })
337
+ window.__reactRouterDataRouter._internalSetStateDoNotUseOrYouWillBreakYourApp(
338
+ {
339
+ loaderData: Object.assign(
340
+ {},
341
+ globalVar.__reactRouterDataRouter.state.loaderData,
342
+ rerender.loaderData
343
+ ),
344
+ errors: rerender.errors ? Object.assign(
345
+ {},
346
+ globalVar.__reactRouterDataRouter.state.errors,
347
+ rerender.errors
348
+ ) : null
349
+ }
350
+ );
351
+ });
352
+ }
353
+ }).catch(() => {
354
+ })
355
+ )
353
356
  );
354
357
  return payloadPromise.then((payload) => {
355
358
  if (payload.type !== "action" && payload.type !== "redirect") {
@@ -373,10 +376,10 @@ function createRouterFromPayload({
373
376
  };
374
377
  if (payload.type !== "render") throw new Error("Invalid payload type");
375
378
  globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
376
- _chunkOLIKX45Ojs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
379
+ _chunkZ4R76DXJjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
377
380
  let patches = /* @__PURE__ */ new Map();
378
381
  _optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => {
379
- _chunkCYHICRRWjs.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
382
+ _chunkM4WLV5HPjs.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
380
383
  if (!patches.has(patch.parentId)) {
381
384
  patches.set(patch.parentId, []);
382
385
  }
@@ -398,12 +401,12 @@ function createRouterFromPayload({
398
401
  }
399
402
  return [route];
400
403
  }, []);
401
- globalVar.__reactRouterDataRouter = _chunkCYHICRRWjs.createRouter.call(void 0, {
404
+ globalVar.__reactRouterDataRouter = _chunkM4WLV5HPjs.createRouter.call(void 0, {
402
405
  routes,
403
406
  getContext,
404
407
  basename: payload.basename,
405
- history: _chunkCYHICRRWjs.createBrowserHistory.call(void 0, ),
406
- hydrationData: _chunkOLIKX45Ojs.getHydrationData.call(void 0, {
408
+ history: _chunkM4WLV5HPjs.createBrowserHistory.call(void 0, ),
409
+ hydrationData: _chunkZ4R76DXJjs.getHydrationData.call(void 0, {
407
410
  state: {
408
411
  loaderData: payload.loaderData,
409
412
  actionData: payload.actionData,
@@ -412,7 +415,7 @@ function createRouterFromPayload({
412
415
  routes,
413
416
  getRouteInfo: (routeId) => {
414
417
  let match = payload.matches.find((m) => m.id === routeId);
415
- _chunkCYHICRRWjs.invariant.call(void 0, match, "Route not found in payload");
418
+ _chunkM4WLV5HPjs.invariant.call(void 0, match, "Route not found in payload");
416
419
  return {
417
420
  clientLoader: match.clientLoader,
418
421
  hasLoader: match.hasLoader,
@@ -510,9 +513,9 @@ function createRouterFromPayload({
510
513
  routeModules: globalVar.__reactRouterRouteModules
511
514
  };
512
515
  }
513
- var renderedRoutesContext = _chunkCYHICRRWjs.createContext.call(void 0, );
516
+ var renderedRoutesContext = _chunkM4WLV5HPjs.createContext.call(void 0, );
514
517
  function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
515
- let dataStrategy = _chunkCYHICRRWjs.getSingleFetchDataStrategyImpl.call(void 0,
518
+ let dataStrategy = _chunkM4WLV5HPjs.getSingleFetchDataStrategyImpl.call(void 0,
516
519
  getRouter,
517
520
  (match) => {
518
521
  let M = match;
@@ -548,38 +551,40 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
548
551
  }
549
552
  renderedRoutesById.get(route.id).push(route);
550
553
  }
551
- for (const match of args.matches) {
552
- const renderedRoutes = renderedRoutesById.get(match.route.id);
553
- if (renderedRoutes) {
554
- for (const rendered of renderedRoutes) {
555
- window.__reactRouterDataRouter.patchRoutes(
556
- _nullishCoalesce(rendered.parentId, () => ( null)),
557
- [createRouteFromServerManifest(rendered)],
558
- true
559
- );
554
+ React3.startTransition(() => {
555
+ for (const match of args.matches) {
556
+ const renderedRoutes = renderedRoutesById.get(match.route.id);
557
+ if (renderedRoutes) {
558
+ for (const rendered of renderedRoutes) {
559
+ window.__reactRouterDataRouter.patchRoutes(
560
+ _nullishCoalesce(rendered.parentId, () => ( null)),
561
+ [createRouteFromServerManifest(rendered)],
562
+ true
563
+ );
564
+ }
560
565
  }
561
566
  }
562
- }
567
+ });
563
568
  return results;
564
569
  });
565
570
  }
566
571
  function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
567
572
  return async (args, basename, targetRoutes) => {
568
573
  let { request, context } = args;
569
- let url = _chunkCYHICRRWjs.singleFetchUrl.call(void 0, request.url, basename, "rsc");
574
+ let url = _chunkM4WLV5HPjs.singleFetchUrl.call(void 0, request.url, basename, "rsc");
570
575
  if (request.method === "GET") {
571
- url = _chunkCYHICRRWjs.stripIndexParam.call(void 0, url);
576
+ url = _chunkM4WLV5HPjs.stripIndexParam.call(void 0, url);
572
577
  if (targetRoutes) {
573
578
  url.searchParams.set("_routes", targetRoutes.join(","));
574
579
  }
575
580
  }
576
581
  let res = await fetchImplementation(
577
- new Request(url, await _chunkCYHICRRWjs.createRequestInit.call(void 0, request))
582
+ new Request(url, await _chunkM4WLV5HPjs.createRequestInit.call(void 0, request))
578
583
  );
579
584
  if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
580
- throw new (0, _chunkCYHICRRWjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
585
+ throw new (0, _chunkM4WLV5HPjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
581
586
  }
582
- _chunkCYHICRRWjs.invariant.call(void 0, res.body, "No response body to decode");
587
+ _chunkM4WLV5HPjs.invariant.call(void 0, res.body, "No response body to decode");
583
588
  try {
584
589
  const payload = await createFromReadableStream(res.body, {
585
590
  temporaryReferences: void 0
@@ -603,7 +608,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
603
608
  }
604
609
  context.get(renderedRoutesContext).push(...payload.matches);
605
610
  let results = { routes: {} };
606
- const dataKey = _chunkCYHICRRWjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
611
+ const dataKey = _chunkM4WLV5HPjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
607
612
  for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
608
613
  results.routes[routeId] = { data };
609
614
  }
@@ -636,7 +641,7 @@ function RSCHydratedRouter({
636
641
  [createFromReadableStream, payload, fetchImplementation, getContext]
637
642
  );
638
643
  React3.useEffect(() => {
639
- _chunkCYHICRRWjs.setIsHydrated.call(void 0, );
644
+ _chunkM4WLV5HPjs.setIsHydrated.call(void 0, );
640
645
  }, []);
641
646
  React3.useLayoutEffect(() => {
642
647
  const globalVar = window;
@@ -645,14 +650,29 @@ function RSCHydratedRouter({
645
650
  globalVar.__reactRouterDataRouter.initialize();
646
651
  }
647
652
  }, []);
648
- let [location2, setLocation] = React3.useState(router2.state.location);
653
+ let [{ routes, state }, setState] = React3.useState(() => ({
654
+ routes: cloneRoutes(router2.routes),
655
+ state: router2.state
656
+ }));
649
657
  React3.useLayoutEffect(
650
658
  () => router2.subscribe((newState) => {
651
- if (newState.location !== location2) {
652
- setLocation(newState.location);
653
- }
659
+ if (diffRoutes(router2.routes, routes))
660
+ React3.startTransition(() => {
661
+ setState({
662
+ routes: cloneRoutes(router2.routes),
663
+ state: newState
664
+ });
665
+ });
666
+ }),
667
+ [router2.subscribe, routes, router2]
668
+ );
669
+ const transitionEnabledRouter = React3.useMemo(
670
+ () => ({
671
+ ...router2,
672
+ state,
673
+ routes
654
674
  }),
655
- [router2, location2]
675
+ [router2, routes, state]
656
676
  );
657
677
  React3.useEffect(() => {
658
678
  if (routeDiscovery === "lazy" || // @ts-expect-error - TS doesn't know about this yet
@@ -723,7 +743,14 @@ function RSCHydratedRouter({
723
743
  routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
724
744
  routeModules
725
745
  };
726
- return /* @__PURE__ */ React3.createElement(_chunkCYHICRRWjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkOLIKX45Ojs.RSCRouterGlobalErrorBoundary, { location: location2 }, /* @__PURE__ */ React3.createElement(_chunkCYHICRRWjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(_chunkCYHICRRWjs.UNSTABLE_TransitionEnabledRouterProvider, { router: router2, flushSync: ReactDOM2.flushSync }))));
746
+ return /* @__PURE__ */ React3.createElement(_chunkM4WLV5HPjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkZ4R76DXJjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkM4WLV5HPjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
747
+ _chunkM4WLV5HPjs.RouterProvider,
748
+ {
749
+ router: transitionEnabledRouter,
750
+ flushSync: ReactDOM2.flushSync,
751
+ unstable_useTransitions: true
752
+ }
753
+ ))));
727
754
  }
728
755
  function createRouteFromServerManifest(match, payload) {
729
756
  let hasInitialData = payload && match.id in payload.loaderData;
@@ -734,8 +761,8 @@ function createRouteFromServerManifest(match, payload) {
734
761
  // the server loader flow regardless of whether the client loader calls
735
762
  // `serverLoader` or not, otherwise we'll have nothing to render.
736
763
  match.hasComponent && !match.element;
737
- _chunkCYHICRRWjs.invariant.call(void 0, window.__reactRouterRouteModules);
738
- _chunkOLIKX45Ojs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
764
+ _chunkM4WLV5HPjs.invariant.call(void 0, window.__reactRouterRouteModules);
765
+ _chunkZ4R76DXJjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
739
766
  let dataRoute = {
740
767
  id: match.id,
741
768
  element: match.element,
@@ -785,7 +812,7 @@ function createRouteFromServerManifest(match, payload) {
785
812
  return await callSingleFetch(singleFetch);
786
813
  }
787
814
  }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
788
- throw _chunkCYHICRRWjs.noActionDefinedError.call(void 0, "action", match.id);
815
+ throw _chunkM4WLV5HPjs.noActionDefinedError.call(void 0, "action", match.id);
789
816
  },
790
817
  path: match.path,
791
818
  shouldRevalidate: match.shouldRevalidate,
@@ -798,7 +825,7 @@ function createRouteFromServerManifest(match, payload) {
798
825
  hasShouldRevalidate: match.shouldRevalidate != null
799
826
  };
800
827
  if (typeof dataRoute.loader === "function") {
801
- dataRoute.loader.hydrate = _chunkCYHICRRWjs.shouldHydrateRouteLoader.call(void 0,
828
+ dataRoute.loader.hydrate = _chunkM4WLV5HPjs.shouldHydrateRouteLoader.call(void 0,
802
829
  match.id,
803
830
  match.clientLoader,
804
831
  match.hasLoader,
@@ -808,7 +835,7 @@ function createRouteFromServerManifest(match, payload) {
808
835
  return dataRoute;
809
836
  }
810
837
  function callSingleFetch(singleFetch) {
811
- _chunkCYHICRRWjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
838
+ _chunkM4WLV5HPjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
812
839
  return singleFetch();
813
840
  }
814
841
  function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
@@ -816,7 +843,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
816
843
  let fn = type === "action" ? "serverAction()" : "serverLoader()";
817
844
  let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
818
845
  console.error(msg);
819
- throw new (0, _chunkCYHICRRWjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
846
+ throw new (0, _chunkM4WLV5HPjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
820
847
  }
821
848
  }
822
849
  var nextPaths = /* @__PURE__ */ new Set();
@@ -859,11 +886,13 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
859
886
  throw new Error("Failed to patch routes");
860
887
  }
861
888
  paths.forEach((p) => addToFifoQueue(p, discoveredPaths));
862
- payload.patches.forEach((p) => {
863
- window.__reactRouterDataRouter.patchRoutes(
864
- _nullishCoalesce(p.parentId, () => ( null)),
865
- [createRouteFromServerManifest(p)]
866
- );
889
+ React3.startTransition(() => {
890
+ payload.patches.forEach((p) => {
891
+ window.__reactRouterDataRouter.patchRoutes(
892
+ _nullishCoalesce(p.parentId, () => ( null)),
893
+ [createRouteFromServerManifest(p)]
894
+ );
895
+ });
867
896
  });
868
897
  }
869
898
  function addToFifoQueue(path, queue) {
@@ -884,6 +913,32 @@ function isExternalLocation(location2) {
884
913
  const newLocation = new URL(location2, window.location.href);
885
914
  return newLocation.origin !== window.location.origin;
886
915
  }
916
+ function cloneRoutes(routes) {
917
+ if (!routes) return void 0;
918
+ return routes.map((route) => ({
919
+ ...route,
920
+ children: cloneRoutes(route.children)
921
+ }));
922
+ }
923
+ function diffRoutes(a, b) {
924
+ if (a.length !== b.length) return true;
925
+ return a.some((route, index) => {
926
+ if (route.element !== b[index].element) return true;
927
+ if (route.errorElement !== b[index].errorElement)
928
+ return true;
929
+ if (route.hydrateFallbackElement !== b[index].hydrateFallbackElement)
930
+ return true;
931
+ if (route.hasErrorBoundary !== b[index].hasErrorBoundary)
932
+ return true;
933
+ if (route.hasLoader !== b[index].hasLoader) return true;
934
+ if (route.hasClientLoader !== b[index].hasClientLoader)
935
+ return true;
936
+ if (route.hasAction !== b[index].hasAction) return true;
937
+ if (route.hasClientAction !== b[index].hasClientAction)
938
+ return true;
939
+ return diffRoutes(route.children || [], b[index].children || []);
940
+ });
941
+ }
887
942
 
888
943
  // lib/rsc/html-stream/browser.ts
889
944
  function getRSCStream() {
@@ -925,4 +980,4 @@ function getRSCStream() {
925
980
 
926
981
 
927
982
 
928
- exports.HydratedRouter = HydratedRouter; exports.RouterProvider = RouterProvider; exports.unstable_RSCHydratedRouter = RSCHydratedRouter; exports.unstable_createCallServer = createCallServer; exports.unstable_getRSCStream = getRSCStream;
983
+ exports.HydratedRouter = HydratedRouter; exports.RouterProvider = RouterProvider2; exports.unstable_RSCHydratedRouter = RSCHydratedRouter; exports.unstable_createCallServer = createCallServer; exports.unstable_getRSCStream = getRSCStream;