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
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 e2f0cca
Remove ?? operator and add lint rules
brophdawg11 3fce264
Add Error serialization
brophdawg11 cdbaa27
Mark loader-less routes with null loaderData during SSR
brophdawg11 e5d0803
Support fetch action redirects in useTransition
brophdawg11 c9e6851
Merge branch 'dev' into brophdawg11/remix-updates
brophdawg11 34ee733
Add _isRedirect state for useTransition back compat
brophdawg11 f188645
Updates for fetcher type and redirect replace logic
brophdawg11 e8d5340
Add tests for SSR null loader values on non-executed loaders
brophdawg11 99993d9
more tests for submission replace/push logic
brophdawg11 e3b31d0
fix test for null loader data during ssr
brophdawg11 470082b
SSr error serialization tests
brophdawg11 239bc7c
form tests
brophdawg11 13a0b4f
Merge branch 'dev' into brophdawg11/remix-updates
brophdawg11 ecbca64
bundle bump
brophdawg11 09209b6
Updates to ScrollRestoration for Remix
brophdawg11 a5e45d7
Export useBeforeUnload
brophdawg11 6c69af5
Avoid SSR layout effects
brophdawg11 9c3548f
Add changesets
brophdawg11 80a50b1
Merge branch 'dev' into brophdawg11/remix-updates
brophdawg11 6239420
Bundle bump
brophdawg11 4066857
Remove skip param
brophdawg11 8ab846b
Update chreck for json content type
brophdawg11 bb40a35
Revert "more tests for submission replace/push logic"
brophdawg11 71d7b2f
Revert "Updates for fetcher type and redirect replace logic"
brophdawg11 2da3b2c
Add _hasFetcherdoneAnything for Remix back-compat
brophdawg11 c3642e0
Remove changeset for redirect logic in new PR
brophdawg11 86699a1
Fix tests
brophdawg11 10b6c5b
Add changeset
brophdawg11 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"react-router-dom": minor | ||
--- | ||
|
||
Add `useBeforeUnload()` hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"react-router-dom": patch | ||
--- | ||
|
||
Support uppercase `<Form method>` and `useSubmit` method values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"react-router-dom": major | ||
--- | ||
|
||
Proper hydration of `Error` objects from `StaticRouterProvider` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@remix-run/router": patch | ||
--- | ||
|
||
Fix explicit `replace` on submissions and `PUSH` on submission to new paths | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"react-router-dom": patch | ||
--- | ||
|
||
Fix `<button formmethod>` form submission overriddes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <>{/*... */}</>; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
"__DEV__": true | ||
}, | ||
"rules": { | ||
"strict": 0 | ||
"strict": 0, | ||
"no-restricted-syntax": ["error", "LogicalExpression[operator='??']"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See |
||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
orredirect
). Replace if it's the same (pathname + search), push otherwise.