Skip to content

Commit

Permalink
Updates to static handler for Remix integration (#9511)
Browse files Browse the repository at this point in the history
* Updates to unstable staticHandler logic for Remix integration

* Add changeset

* bump bundle

* Remove ErrorWithStatus in favor of extended ErrorResponse

* update

* Update changelog
  • Loading branch information
brophdawg11 committed Nov 1, 2022
1 parent a9b75e8 commit 67f16e7
Show file tree
Hide file tree
Showing 7 changed files with 446 additions and 238 deletions.
6 changes: 6 additions & 0 deletions .changeset/proud-timers-tickle.md
@@ -0,0 +1,6 @@
---
"@remix-run/router": patch
---

- Throw an error if an `action`/`loader` function returns `undefined` as revalidations need to know whether the loader has previously been executed. `undefined` also causes issues during SSR stringification for hydration. You should always ensure you loader/acton return a value, and you may return `null` if you don't wish to return anything.
- Enhanced `ErrorResponse` bodies to contain more descriptive text in internal 403/404/405 scenarios
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -107,7 +107,7 @@
},
"filesize": {
"packages/router/dist/router.umd.min.js": {
"none": "34 kB"
"none": "34.5 kB"
},
"packages/react-router/dist/react-router.production.min.js": {
"none": "12.5 kB"
Expand Down
10 changes: 5 additions & 5 deletions packages/react-router-dom/__tests__/nav-link-active-test.tsx
Expand Up @@ -509,7 +509,7 @@ describe("NavLink using a data router", () => {
fireEvent.click(screen.getByText("Link to Bar"));
expect(screen.getByText("Link to Bar").className).toBe("pending");

dfd.resolve();
dfd.resolve(null);
await waitFor(() => screen.getByText("Bar page"));
expect(screen.getByText("Link to Bar").className).toBe("active");
});
Expand Down Expand Up @@ -562,7 +562,7 @@ describe("NavLink using a data router", () => {
"some-pending-classname"
);

dfd.resolve();
dfd.resolve(null);
await waitFor(() => screen.getByText("Bar page"));
expect(screen.getByText("Link to Bar").className).toBe(
"some-active-classname"
Expand Down Expand Up @@ -617,7 +617,7 @@ describe("NavLink using a data router", () => {
"lowercase"
);

dfd.resolve();
dfd.resolve(null);
await waitFor(() => screen.getByText("Bar page"));
expect(screen.getByText("Link to Bar").style.textTransform).toBe(
"uppercase"
Expand Down Expand Up @@ -667,7 +667,7 @@ describe("NavLink using a data router", () => {
fireEvent.click(screen.getByText("Link to Bar (idle)"));
expect(screen.getByText("Link to Bar (loading...)")).toBeDefined();

dfd.resolve();
dfd.resolve(null);
await waitFor(() => screen.getByText("Bar page"));
expect(screen.getByText("Link to Bar (current)")).toBeDefined();
});
Expand Down Expand Up @@ -708,7 +708,7 @@ describe("NavLink using a data router", () => {
fireEvent.click(screen.getByText("Link to Baz"));
expect(screen.getByText("Link to Bar").className).toBe("");

dfd.resolve();
dfd.resolve(null);
await waitFor(() => screen.getByText("Baz page"));
expect(screen.getByText("Link to Bar").className).toBe("");
});
Expand Down
Expand Up @@ -2713,7 +2713,7 @@ describe("<DataMemoryRouter>", () => {
expect(getAwaitRenderCount()).toBe(3);

// complete /baz navigation
bazDefer.resolve();
bazDefer.resolve(null);
await waitFor(() => screen.getByText("Baz"));
expect(getHtml(container)).toMatchInlineSnapshot(`
"<div
Expand Down

0 comments on commit 67f16e7

Please sign in to comment.