Skip to content

Commit 4df618a

Browse files
committed
Update changelog
1 parent f74a1eb commit 4df618a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

.changeset/smart-ads-doubt.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
"react-router": patch
33
---
44

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
66

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
149
- ⚠️ 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

Comments
 (0)