Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to static handler for Remix integration #9511

Merged
merged 7 commits into from Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests used to return undefined, so make them return null now

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