react-router-dom 6.25.0 → 6.25.1-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # `react-router-dom`
2
2
 
3
+ ## 6.25.1-pre.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Memoize some `RouterProvider` internals to reduce uneccesary re-renders ([#11803](https://github.com/remix-run/react-router/pull/11803))
8
+ - Updated dependencies:
9
+ - `react-router@6.25.1-pre.0`
10
+
3
11
  ## 6.25.0
4
12
 
5
13
  ### Minor Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router DOM v6.25.0
2
+ * React Router DOM v6.25.1-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -571,6 +571,9 @@ function RouterProvider(_ref) {
571
571
  static: false,
572
572
  basename
573
573
  }), [router, navigator, basename]);
574
+ let routerFuture = React.useMemo(() => ({
575
+ v7_relativeSplatPath: router.future.v7_relativeSplatPath
576
+ }), [router.future.v7_relativeSplatPath]);
574
577
  // The fragment and {null} here are important! We need them to keep React 18's
575
578
  // useId happy when we are server-rendering since we may have a <script> here
576
579
  // containing the hydrated server-side staticContext (from StaticRouterProvider).
@@ -590,15 +593,15 @@ function RouterProvider(_ref) {
590
593
  location: state.location,
591
594
  navigationType: state.historyAction,
592
595
  navigator: navigator,
593
- future: {
594
- v7_relativeSplatPath: router.future.v7_relativeSplatPath
595
- }
596
- }, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {
596
+ future: routerFuture
597
+ }, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(MemoizedDataRoutes, {
597
598
  routes: router.routes,
598
599
  future: router.future,
599
600
  state: state
600
601
  }) : fallbackElement))))), null);
601
602
  }
603
+ // Memoize to avoid re-renders when updating `ViewTransitionContext`
604
+ const MemoizedDataRoutes = /*#__PURE__*/React.memo(DataRoutes);
602
605
  function DataRoutes(_ref3) {
603
606
  let {
604
607
  routes,