Skip to content

Commit 3eac3a6

Browse files
jacob-ebeypcattoribrophdawg11
authored
feat: mutable route tree (#9996)
* initial work + test outline * wip: addRoute,updateRoute,deleteRoute * refactor(hmr): internal api for updating routes and revalidating * refactor: _internalSetRoutes * test: update method name after rename * revalidate in tests * chore: remove data for routes with no loader test: cover navigation interruption * add changeset * Add a couple more tests * Fix invalid useRouteLoaderData test * Handle HMR use cases for revalidating fetchers * Bump bundle --------- Co-authored-by: Pedro Cattori <pcattori@gmail.com> Co-authored-by: Matt Brophy <matt@brophy.org>
1 parent bbe4ec5 commit 3eac3a6

File tree

6 files changed

+561
-61
lines changed

6 files changed

+561
-61
lines changed

.changeset/quick-yaks-join.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@remix-run/router": patch
3+
---
4+
5+
Add internal API for custom HMR implementations

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
},
106106
"filesize": {
107107
"packages/router/dist/router.umd.min.js": {
108-
"none": "41.5 kB"
108+
"none": "41.6 kB"
109109
},
110110
"packages/react-router/dist/react-router.production.min.js": {
111111
"none": "13 kB"

packages/react-router-dom/server.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ export function createStaticRouter(
307307
},
308308
_internalFetchControllers: new Map(),
309309
_internalActiveDeferreds: new Map(),
310+
_internalSetRoutes() {
311+
throw msg("_internalSetRoutes");
312+
},
310313
};
311314
}
312315

packages/react-router/__tests__/data-memory-router-test.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,6 @@ describe("<DataMemoryRouter>", () => {
821821
initialEntries={["/foo"]}
822822
hydrationData={{
823823
loaderData: {
824-
layout: null,
825824
foo: "FOO",
826825
},
827826
}}
@@ -861,7 +860,7 @@ describe("<DataMemoryRouter>", () => {
861860
}
862861

863862
expect(spy).toHaveBeenCalledWith({
864-
layout: null,
863+
layout: undefined,
865864
foo: "FOO",
866865
bar: undefined,
867866
child: undefined,
@@ -896,7 +895,7 @@ describe("<DataMemoryRouter>", () => {
896895
</div>"
897896
`);
898897
expect(spy).toHaveBeenCalledWith({
899-
layout: null,
898+
layout: undefined,
900899
foo: undefined,
901900
bar: undefined,
902901
child: "CHILD",

0 commit comments

Comments
 (0)