react-router 6.21.0-pre.3 → 6.21.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,22 +1,14 @@
1
1
  # `react-router`
2
2
 
3
- ## 6.21.0-pre.3
3
+ ## 6.21.1-pre.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [REMOVE] Refactor internals for partial hydration ([#11094](https://github.com/remix-run/react-router/pull/11094))
7
+ - Fix bug with `route.lazy` not working correctly on initial SPA load when `v7_partialHydration` is specified ([#11121](https://github.com/remix-run/react-router/pull/11121))
8
8
  - Updated dependencies:
9
- - `@remix-run/router@1.14.0-pre.1`
9
+ - `@remix-run/router@1.14.1-pre.0`
10
10
 
11
- ## 6.21.0-pre.2
12
-
13
- ## 6.21.0-pre.1
14
-
15
- ### Patch Changes
16
-
17
- - [REMOVE] Fix plumbing of future flags ([`558d7936`](https://github.com/remix-run/react-router/commit/558d7936cc8fe643374a2c9a9fdcf022e8c4c939))
18
-
19
- ## 6.21.0-pre.0
11
+ ## 6.21.0
20
12
 
21
13
  ### Minor Changes
22
14
 
@@ -124,7 +116,7 @@
124
116
  <BrowserRouter>
125
117
  <Routes>
126
118
  <Route path="dashboard">
127
- <Route path="*" element={<Dashboard />} />
119
+ <Route index path="*" element={<Dashboard />} />
128
120
  </Route>
129
121
  </Routes>
130
122
  </BrowserRouter>
@@ -155,7 +147,7 @@
155
147
 
156
148
  - Properly handle falsy error values in ErrorBoundary's ([#11071](https://github.com/remix-run/react-router/pull/11071))
157
149
  - Updated dependencies:
158
- - `@remix-run/router@1.14.0-pre.0`
150
+ - `@remix-run/router@1.14.0`
159
151
 
160
152
  ## 6.20.1
161
153
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.21.0-pre.3
2
+ * React Router v6.21.1-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -378,7 +378,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
378
378
  });
379
379
  if (process.env.NODE_ENV !== "production") {
380
380
  process.env.NODE_ENV !== "production" ? UNSAFE_warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") : void 0;
381
- process.env.NODE_ENV !== "production" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" " + "does not have an element or Component. This means it will render an <Outlet /> with a " + "null value by default resulting in an \"empty\" page.") : void 0;
381
+ process.env.NODE_ENV !== "production" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" " + "does not have an element or Component. This means it will render an <Outlet /> with a " + "null value by default resulting in an \"empty\" page.") : void 0;
382
382
  }
383
383
  let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
384
384
  params: Object.assign({}, parentParams, match.params),
@@ -552,17 +552,24 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
552
552
  if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
553
553
  fallbackIndex = i;
554
554
  }
555
- if (match.route.loader && match.route.id && dataRouterState.loaderData[match.route.id] === undefined && (!dataRouterState.errors || dataRouterState.errors[match.route.id] === undefined)) {
556
- // We found the first route without data/errors which means it's loader
557
- // still needs to run. Flag that we need to render a fallback and
558
- // render up until the appropriate fallback
559
- renderFallback = true;
560
- if (fallbackIndex >= 0) {
561
- renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
562
- } else {
563
- renderedMatches = [renderedMatches[0]];
555
+ if (match.route.id) {
556
+ let {
557
+ loaderData,
558
+ errors
559
+ } = dataRouterState;
560
+ let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);
561
+ if (match.route.lazy || needsToRunLoader) {
562
+ // We found the first route that's not ready to render (waiting on
563
+ // lazy, or has a loader that hasn't run yet). Flag that we need to
564
+ // render a fallback and render up until the appropriate fallback
565
+ renderFallback = true;
566
+ if (fallbackIndex >= 0) {
567
+ renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
568
+ } else {
569
+ renderedMatches = [renderedMatches[0]];
570
+ }
571
+ break;
564
572
  }
565
- break;
566
573
  }
567
574
  }
568
575
  }