You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .changeset/smart-ads-doubt.md
+3-8Lines changed: 3 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,8 @@
2
2
"react-router": patch
3
3
---
4
4
5
-
Do not automatically add `null` to `staticHandler.query()``loaderData` if routes do not have loaders
5
+
Do not automatically add `null` to `staticHandler.query()``context.loaderData` if routes do not have loaders
6
6
7
-
- This was a requirement for Remix v2 because we used `JSON.stringify()` to serialize the `loaderData` of the client and it would strip `undefined` values which would cause issues for client-side router hydration
8
-
- Therefore, we had a restriction that you could not return `undefined` from a `loader`/`action`
9
-
- We used to check `loaderData[routeId] !== undefined` to see if a given route already had any data or not
10
-
- Once we implemented Single fetch and began serializing data via `turbo-stream`, we no longer has this restriction because it can serialize `undefined` correctly
11
-
- In React Router v7, we began allowing loaders to return `undefined`
12
-
- Therefore, our check of `loaderData[routeId] !== undefined` was no longer valid and we adjusted to a check of `routeId in loaderData`
13
-
- This check can fail if we are sticking a null value in `loaderData`, so we have to remove that logic
7
+
- This was a Remix v2 implementation detail inadvertently left in for React Router v7
8
+
- Now that we allow returning `undefined` from loaders, our prior check of `loaderData[routeId] !== undefined` was no longer sufficient and was changed to a `routeId in loaderData` check - these `null` values can cause issues for this new check
14
9
- ⚠️ This could be a "breaking bug fix" for you if you are doing manual SSR with `createStaticHandler()`/`<StaticRouterProvider>`, and using `context.loaderData` to control `<RouterProvider>` hydration behavior on the client
0 commit comments