react-router 0.0.0-experimental-51412399d → 0.0.0-experimental-abc385596

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 (60) hide show
  1. package/CHANGELOG.md +71 -49
  2. package/dist/development/{browser-CRsXgNrY.d.mts → browser-3AnU12UI.d.mts} +1 -1
  3. package/dist/development/{browser-wDl1FZEL.d.ts → browser-BOdXz9dK.d.ts} +1 -1
  4. package/dist/development/{chunk-ZL3ABFHJ.js → chunk-455JCIZ4.js} +7 -7
  5. package/dist/{production/chunk-IHRXRDPC.js → development/chunk-JG23XKJ4.js} +106 -103
  6. package/dist/development/{chunk-SVMMCML6.mjs → chunk-NQJPHWDN.mjs} +218 -104
  7. package/dist/{production/chunk-2RCPEQKS.mjs → development/chunk-PSUL3UUV.mjs} +22 -21
  8. package/dist/development/{chunk-GKLAGYEJ.js → chunk-WXPXGSJW.js} +239 -128
  9. package/dist/development/{context-BQs41HrG.d.mts → context-ByvtofY2.d.mts} +7 -1
  10. package/dist/development/dom-export.d.mts +2 -2
  11. package/dist/development/dom-export.d.ts +2 -2
  12. package/dist/development/dom-export.js +48 -50
  13. package/dist/development/dom-export.mjs +23 -25
  14. package/dist/development/{index-react-server-client-CSv-KZBk.d.ts → index-react-server-client-BS5F89FR.d.ts} +10 -2
  15. package/dist/{production/index-react-server-client-Ck_yZ1qL.d.mts → development/index-react-server-client-DY04-103.d.mts} +10 -2
  16. package/dist/development/index-react-server-client.d.mts +2 -2
  17. package/dist/development/index-react-server-client.d.ts +2 -2
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.d.mts +6 -0
  21. package/dist/development/index-react-server.d.ts +6 -0
  22. package/dist/development/index-react-server.js +4 -4
  23. package/dist/development/index-react-server.mjs +4 -4
  24. package/dist/development/index.d.mts +91 -9
  25. package/dist/development/index.d.ts +91 -9
  26. package/dist/development/index.js +103 -100
  27. package/dist/development/index.mjs +5 -3
  28. package/dist/development/{instrumentation-DlJ2QV7d.d.ts → instrumentation-cRWWLfsU.d.ts} +7 -1
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/production/{browser-CRsXgNrY.d.mts → browser-3AnU12UI.d.mts} +1 -1
  32. package/dist/production/{browser-wDl1FZEL.d.ts → browser-BOdXz9dK.d.ts} +1 -1
  33. package/dist/production/{chunk-DC7JPQBT.js → chunk-DENJ7T3K.js} +239 -128
  34. package/dist/{development/chunk-BIEE535F.js → production/chunk-FWTPT7JC.js} +106 -103
  35. package/dist/{development/chunk-5WN7IGPD.mjs → production/chunk-GNIM2PY3.mjs} +22 -21
  36. package/dist/production/{chunk-OYRGGHOQ.mjs → chunk-LL25D23O.mjs} +218 -104
  37. package/dist/production/{chunk-QO54DH43.js → chunk-TJHQJD4R.js} +7 -7
  38. package/dist/production/{context-BQs41HrG.d.mts → context-ByvtofY2.d.mts} +7 -1
  39. package/dist/production/dom-export.d.mts +2 -2
  40. package/dist/production/dom-export.d.ts +2 -2
  41. package/dist/production/dom-export.js +48 -50
  42. package/dist/production/dom-export.mjs +23 -25
  43. package/dist/production/{index-react-server-client-CSv-KZBk.d.ts → index-react-server-client-BS5F89FR.d.ts} +10 -2
  44. package/dist/{development/index-react-server-client-Ck_yZ1qL.d.mts → production/index-react-server-client-DY04-103.d.mts} +10 -2
  45. package/dist/production/index-react-server-client.d.mts +2 -2
  46. package/dist/production/index-react-server-client.d.ts +2 -2
  47. package/dist/production/index-react-server-client.js +4 -4
  48. package/dist/production/index-react-server-client.mjs +2 -2
  49. package/dist/production/index-react-server.d.mts +6 -0
  50. package/dist/production/index-react-server.d.ts +6 -0
  51. package/dist/production/index-react-server.js +4 -4
  52. package/dist/production/index-react-server.mjs +4 -4
  53. package/dist/production/index.d.mts +91 -9
  54. package/dist/production/index.d.ts +91 -9
  55. package/dist/production/index.js +103 -100
  56. package/dist/production/index.mjs +5 -3
  57. package/dist/production/{instrumentation-DlJ2QV7d.d.ts → instrumentation-cRWWLfsU.d.ts} +7 -1
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,81 +1,103 @@
1
1
  # `react-router`
2
2
 
3
+ ## v7.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Update router to operate on fetcher Maps in an immutable manner to avoid delayed React renders from potentially reading an updated but not yet committed Map. This could result in brief flickers in some fetcher-driven optimistic UI scenarios. ([6bf91ce](https://github.com/remix-run/react-router/commit/6bf91ce))
8
+ - Fix `serverLoader()` returning stale SSR data when a client navigation aborts pending hydration before the hydration `clientLoader` resolves ([#15022](https://github.com/remix-run/react-router/pull/15022))
9
+ - Fix `RouterProvider` `onError` callback not being called for synchronous initial loader errors in SPA mode ([#14942](https://github.com/remix-run/react-router/pull/14942))
10
+ - Memoize `useFetchers` to return a stable identity and only change if fetchers changed ([#15028](https://github.com/remix-run/react-router/pull/15028))
11
+ - Internal refactor to consolidate mutation request detection through shared utility ([#15033](https://github.com/remix-run/react-router/pull/15033))
12
+
13
+ ### Unstable Changes
14
+
15
+ ⚠️ _[Unstable features](https://reactrouter.com/community/api-development-strategy#unstable-flags) are not recommended for production use_
16
+
17
+ - Add a new `unstable_useRouterState()` hook that consolidates access to active and pending router states (RFC: #12358) ([4322e58](https://github.com/remix-run/react-router/commit/4322e58))
18
+
19
+ - Data/Framework/RSC only — throws when used without a data router
20
+ - This should allow you to consolidate usages of the following hooks which will likely be deprecated and removed in a future major version
21
+ - `useLocation`
22
+ - `useSearchParams`
23
+ - `useParams`
24
+ - `useMatches`
25
+ - `useNavigationType`
26
+ - `useNavigation`
27
+
28
+ ```ts
29
+ let { active, pending } = unstable_useRouterState();
30
+
31
+ // Active is always populated with the current location
32
+ active.location; // replaces `useLocation()`
33
+ active.searchParams; // replaces `useSearchParams()[0]`
34
+ active.params; // replaces `useParams()`
35
+ active.matches; // replaces `useMatches()`
36
+ active.type; // replaces `useNavigationType()`
37
+
38
+ // Pending is only populated during a navigation
39
+ pending.location; // replaces `useNavigation().location`
40
+ pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`
41
+ pending.params; // Not directly accessible today
42
+ pending.matches; // Not directly accessible today
43
+ pending.type; // Not directly accessible today
44
+ pending.state; // replaces `useNavigation().state`
45
+ pending.formMethod; // replaces useNavigation().formMethod
46
+ pending.formAction; // replaces useNavigation().formAction
47
+ pending.formEncType; // replaces useNavigation().formEncType
48
+ pending.formData; // replaces useNavigation().formData
49
+ pending.json; // replaces useNavigation().json
50
+ pending.text; // replaces useNavigation().text
51
+ ```
52
+
3
53
  ## v7.15.0
4
54
 
5
55
  ### Minor Changes
6
56
 
7
- - Stabilize `unstable_defaultShouldRevalidate` as `defaultShouldRevalidate` on `<Link>`, `<Form>`, `useLinkClickHandler`, `useSubmit`, `fetcher.submit`, and `setSearchParams` ([#14999](https://github.com/remix-run/react-router/pull/14999))
8
-
9
- - Stabilize the instrumentation APIs. `unstable_instrumentations` is now `instrumentations` and `unstable_pattern` is now `pattern` ([#14999](https://github.com/remix-run/react-router/pull/14999))
57
+ - Stabilize `unstable_defaultShouldRevalidate` as `defaultShouldRevalidate` on `<Link>`, `<Form>`, `useLinkClickHandler`, `useSubmit`, `fetcher.submit`, and `setSearchParams` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
58
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
10
59
 
60
+ - Stabilize the instrumentation APIs. `unstable_instrumentations` is now `instrumentations` and `unstable_pattern` is now `pattern` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
11
61
  - The `unstable_ServerInstrumentation`, `unstable_ClientInstrumentation`, `unstable_InstrumentRequestHandlerFunction`, `unstable_InstrumentRouterFunction`, `unstable_InstrumentRouteFunction`, and `unstable_InstrumentationHandlerResult` types have had their `unstable_` prefixes removed
62
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
12
63
 
13
- - Stabilize `unstable_mask` as `mask` on `<Link>`, `useLinkClickHandler`, and `useNavigate`, and rename the corresponding `Location.unstable_mask` field to `Location.mask` ([#14999](https://github.com/remix-run/react-router/pull/14999))
64
+ - Stabilize `unstable_mask` as `mask` on `<Link>`, `useLinkClickHandler`, and `useNavigate`, and rename the corresponding `Location.unstable_mask` field to `Location.mask` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
65
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
14
66
 
15
- - Stabilize the `unstable_normalizePath` option on `staticHandler.query` and `staticHandler.queryRoute` as `normalizePath` ([#14999](https://github.com/remix-run/react-router/pull/14999))
67
+ - Stabilize the `unstable_normalizePath` option on `staticHandler.query` and `staticHandler.queryRoute` as `normalizePath` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
68
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
16
69
 
17
- - Stabilize `future.unstable_passThroughRequests` as `future.v8_passThroughRequests` ([#14999](https://github.com/remix-run/react-router/pull/14999))
70
+ - Stabilize `future.unstable_passThroughRequests` as `future.v8_passThroughRequests` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
71
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
18
72
 
19
- - Remove `unstable_subResourceIntegrity` from the runtime `FutureConfig` type; the flag is now controlled by the top-level `subResourceIntegrity` option in `react-router.config.ts` ([#14999](https://github.com/remix-run/react-router/pull/14999))
73
+ - Remove `unstable_subResourceIntegrity` from the runtime `FutureConfig` type; the flag is now controlled by the top-level `subResourceIntegrity` option in `react-router.config.ts` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
74
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
20
75
 
21
- - Stabilize `unstable_url` as `url` on `loader`, `action`, and `middleware` function args ([#14999](https://github.com/remix-run/react-router/pull/14999))
76
+ - Stabilize `unstable_url` as `url` on `loader`, `action`, and `middleware` function args ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
77
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
22
78
 
23
- - Stabilize `unstable_useTransitions` as `useTransitions` on `<BrowserRouter>`, `<HashRouter>`, `<HistoryRouter>`, `<MemoryRouter>`, `<Router>`, `<RouterProvider>`, `<HydratedRouter>`, and `useLinkClickHandler` ([#14999](https://github.com/remix-run/react-router/pull/14999))
79
+ - Stabilize `unstable_useTransitions` as `useTransitions` on `<BrowserRouter>`, `<HashRouter>`, `<HistoryRouter>`, `<MemoryRouter>`, `<Router>`, `<RouterProvider>`, `<HydratedRouter>`, and `useLinkClickHandler` ([a993f09](https://github.com/remix-run/react-router/commit/a993f09))
80
+ - ⚠️ This is a breaking change if you have already opted into the unstable version - you will need to update your code accordingly
24
81
 
25
82
  ### Patch Changes
26
83
 
27
- - Add nonce to scripts modulepreload ([#15002](https://github.com/remix-run/react-router/pull/15002))
84
+ - Add `nonce` to `<Scripts>` `<link rel="modulepreload">` elements (if provided) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
28
85
 
29
86
  - Fix a bug with `unstable_defaultShouldRevalidate={false}` where parent routes that did not export a `shouldRevalidate` function could be incorrectly included in the single fetch call for new child route data ([#15012](https://github.com/remix-run/react-router/pull/15012))
30
87
 
31
- - Improve server-side route matching performance by pre-computing flattened/cached route branches ([#14967](https://github.com/remix-run/react-router/pull/14967)) ([10a9686](https://github.com/remix-run/react-router/commit/10a9686))
32
-
33
- - Performance benchmark
34
- - 100 route app, 3000 requests @ 10x concurrency across 38 distinct paths
35
- - `dev` branch
36
- - Throughput: 826.1 req/s
37
- - Latency mean: 10.227ms
38
- - Latency p50: 11.125ms
39
- - Latency p95: 13.056ms
40
- - Latency p99: 16.753ms
41
- - Latency min: 1.739ms
42
- - Latency max: 20.268ms
43
- - This branch
44
- - Throughput: 952.7 req/s (15.3% improvement)
45
- - Latency mean: 8.716ms (14.8% improvement)
46
- - Latency p50: 9.452ms
47
- - Latency p95: 11.610ms
48
- - Latency p99: 12.544ms
49
- - Latency min: 1.656ms
50
- - Latency max: 15.936ms
88
+ - Improve server-side route matching performance by pre-computing flattened/cached route branches ([#14967](https://github.com/remix-run/react-router/pull/14967)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
89
+ - Performance benchmarks showed roughly a 10-15% improvement in server-side request handling performance
51
90
 
52
91
  - Mark `mask` as an optional field in `Location` for easier mocking in unit tests ([#14999](https://github.com/remix-run/react-router/pull/14999))
53
92
 
54
93
  - Cache flattened/ranked route branches to optimize server-side route matching ([#14967](https://github.com/remix-run/react-router/pull/14967))
55
94
 
56
- - Improve route matching performance in Framework/Data Mode ([#14971](https://github.com/remix-run/react-router/pull/14971)) ([362635b](https://github.com/remix-run/react-router/commit/362635b))
57
-
95
+ - Improve route matching performance in Framework/Data Mode ([#14971](https://github.com/remix-run/react-router/pull/14971)) ([af5d49b](https://github.com/remix-run/react-router/commit/af5d49b))
58
96
  - Avoiding unnecessary calls to `matchRoutes` in data router scenarios
59
97
  - This includes adding back the optimization that was removed in `7.6.0` ([#13562](https://github.com/remix-run/react-router/pull/13562))
60
98
  - The issues that prompted the revert have been addressed by using the available router `matches` but always updating `match.route` to the latest route in the `manifest`
61
99
  - Leverage pre-computed pre-computing flattened/cached route branches during client side route matching
62
- - This builds on top of prior server optimizations and provides an additional set of gains (~30%):
63
- - Original server optimizations branch
64
- - Throughput: 952.7 req/s
65
- - Latency mean: 8.716ms
66
- - Latency p50: 9.452ms
67
- - Latency p95: 11.610ms
68
- - Latency p99: 12.544ms
69
- - Latency min: 1.656ms
70
- - Latency max: 15.936ms
71
- - This branch
72
- - Throughput: 1235.3 req/s
73
- - Latency mean: 6.095ms
74
- - Latency p50: 6.655ms
75
- - Latency p95: 8.327ms
76
- - Latency p99: 12.133ms
77
- - Latency min: 1.066ms
78
- - Latency max: 19.056ms
100
+ - Performance benchmarks showed roughly a 15-30% improvement in server-side request handling performance
79
101
 
80
102
  ## v7.14.2
81
103
 
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { R as RouterInit } from './context-BQs41HrG.mjs';
2
+ import { R as RouterInit } from './context-ByvtofY2.mjs';
3
3
  import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BVUf681J.mjs';
4
4
 
5
5
  declare function getRequest(): Request;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { R as RouterInit } from './instrumentation-DlJ2QV7d.js';
2
+ import { R as RouterInit } from './instrumentation-cRWWLfsU.js';
3
3
  import { L as Location, C as ClientActionFunction, a as ClientLoaderFunction, b as LinksFunction, M as MetaFunction, S as ShouldRevalidateFunction, P as Params, c as RouterContextProvider, A as ActionFunction, H as HeadersFunction, d as LoaderFunction } from './data-BqZ2x964.js';
4
4
 
5
5
  declare function getRequest(): Request;
@@ -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 v0.0.0-experimental-51412399d
2
+ * react-router v0.0.0-experimental-abc385596
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- var _chunkGKLAGYEJjs = require('./chunk-GKLAGYEJ.js');
17
+ var _chunkWXPXGSJWjs = require('./chunk-WXPXGSJW.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 = _chunkGKLAGYEJjs.matchRoutes.call(void 0, routes, location, basename);
32
+ let initialMatches = _chunkWXPXGSJWjs.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 (_chunkGKLAGYEJjs.shouldHydrateRouteLoader.call(void 0,
37
+ if (_chunkWXPXGSJWjs.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 (_chunkGKLAGYEJjs.isRouteErrorResponse.call(void 0, error)) {
115
+ if (_chunkWXPXGSJWjs.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
- _chunkGKLAGYEJjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
123
+ _chunkWXPXGSJWjs.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 = _chunkGKLAGYEJjs.useRouteError.call(void 0, );
149
+ let error = _chunkWXPXGSJWjs.useRouteError.call(void 0, );
150
150
  if (hasRootLayout === void 0) {
151
151
  throw new Error("Missing 'hasRootLayout' prop");
152
152
  }