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 for Remix on RR 6.4 #9664

Merged
merged 29 commits into from Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dc5dddf
Allow uppercase <Form> methods and fix submitted method override
brophdawg11 Dec 1, 2022
e2f0cca
Remove ?? operator and add lint rules
brophdawg11 Dec 1, 2022
3fce264
Add Error serialization
brophdawg11 Dec 1, 2022
cdbaa27
Mark loader-less routes with null loaderData during SSR
brophdawg11 Dec 1, 2022
e5d0803
Support fetch action redirects in useTransition
brophdawg11 Dec 2, 2022
c9e6851
Merge branch 'dev' into brophdawg11/remix-updates
brophdawg11 Dec 7, 2022
34ee733
Add _isRedirect state for useTransition back compat
brophdawg11 Dec 8, 2022
f188645
Updates for fetcher type and redirect replace logic
brophdawg11 Dec 8, 2022
e8d5340
Add tests for SSR null loader values on non-executed loaders
brophdawg11 Dec 9, 2022
99993d9
more tests for submission replace/push logic
brophdawg11 Dec 9, 2022
e3b31d0
fix test for null loader data during ssr
brophdawg11 Dec 9, 2022
470082b
SSr error serialization tests
brophdawg11 Dec 9, 2022
239bc7c
form tests
brophdawg11 Dec 9, 2022
13a0b4f
Merge branch 'dev' into brophdawg11/remix-updates
brophdawg11 Dec 12, 2022
ecbca64
bundle bump
brophdawg11 Dec 12, 2022
09209b6
Updates to ScrollRestoration for Remix
brophdawg11 Dec 12, 2022
a5e45d7
Export useBeforeUnload
brophdawg11 Dec 12, 2022
6c69af5
Avoid SSR layout effects
brophdawg11 Dec 12, 2022
9c3548f
Add changesets
brophdawg11 Dec 13, 2022
80a50b1
Merge branch 'dev' into brophdawg11/remix-updates
brophdawg11 Dec 13, 2022
6239420
Bundle bump
brophdawg11 Dec 14, 2022
4066857
Remove skip param
brophdawg11 Dec 15, 2022
8ab846b
Update chreck for json content type
brophdawg11 Dec 15, 2022
bb40a35
Revert "more tests for submission replace/push logic"
brophdawg11 Dec 15, 2022
71d7b2f
Revert "Updates for fetcher type and redirect replace logic"
brophdawg11 Dec 15, 2022
2da3b2c
Add _hasFetcherdoneAnything for Remix back-compat
brophdawg11 Dec 15, 2022
c3642e0
Remove changeset for redirect logic in new PR
brophdawg11 Dec 15, 2022
86699a1
Fix tests
brophdawg11 Dec 15, 2022
10b6c5b
Add changeset
brophdawg11 Dec 15, 2022
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
5 changes: 5 additions & 0 deletions .changeset/afraid-kiwis-grow.md
@@ -0,0 +1,5 @@
---
"react-router-dom": minor
---

Add `useBeforeUnload()` hook
5 changes: 5 additions & 0 deletions .changeset/bright-gorillas-pump.md
@@ -0,0 +1,5 @@
---
"react-router-dom": patch
---

Support uppercase `<Form method>` and `useSubmit` method values
5 changes: 5 additions & 0 deletions .changeset/empty-teachers-tie.md
@@ -0,0 +1,5 @@
---
"react-router-dom": major
---

Proper hydration of `Error` objects from `StaticRouterProvider`
5 changes: 5 additions & 0 deletions .changeset/itchy-swans-travel.md
@@ -0,0 +1,5 @@
---
"@remix-run/router": patch
---

Fix explicit `replace` on submissions and `PUSH` on submission to new paths
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change implementation to be based on the next location (either from formAction or redirect). Replace if it's the same (pathname + search), push otherwise.

5 changes: 5 additions & 0 deletions .changeset/small-dots-try.md
@@ -0,0 +1,5 @@
---
"react-router-dom": patch
---

Fix `<button formmethod>` form submission overriddes
32 changes: 32 additions & 0 deletions docs/hooks/use-before-unload.md
@@ -0,0 +1,32 @@
---
title: useBeforeUnload
new: true
---

# `useBeforeUnload`

This hook is just a helper around `window.onbeforeunload`. It can be useful to save important application state on the page (to something like the browser's local storage), before the user navigates away from your page. That way if they come back you can restore any stateful information (restore form input values, etc.)

```tsx lines=[1,7-11]
import { useBeforeUnload } from "react-router-dom";

function SomeForm() {
const [state, setState] = React.useState(null);

// save it off before users navigate away
useBeforeUnload(
React.useCallback(() => {
localStorage.stuff = state;
}, [state])
);

// read it in when they return
React.useEffect(() => {
if (state === null && localStorage.stuff != null) {
setState(localStorage.stuff);
}
}, [state]);

return <>{/*... */}</>;
}
```
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -107,7 +107,7 @@
},
"filesize": {
"packages/router/dist/router.umd.min.js": {
"none": "36.5 kB"
"none": "37 kB"
},
"packages/react-router/dist/react-router.production.min.js": {
"none": "12.5 kB"
Expand All @@ -116,7 +116,7 @@
"none": "14.5 kB"
},
"packages/react-router-dom/dist/react-router-dom.production.min.js": {
"none": "10.5 kB"
"none": "11 kB"
},
"packages/react-router-dom/dist/umd/react-router-dom.production.min.js": {
"none": "16.5 kB"
Expand Down
3 changes: 2 additions & 1 deletion packages/react-router-dom/.eslintrc
Expand Up @@ -7,6 +7,7 @@
"__DEV__": true
},
"rules": {
"strict": 0
"strict": 0,
"no-restricted-syntax": ["error", "LogicalExpression[operator='??']"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See ?? removal below - added a lint rule to prevent that showing up again

}
}