Skip to content

Commit

Permalink
Merge branch 'dev' into usesearchparams-patch-in-firefox-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Jul 13, 2023
2 parents e51c18d + 1b8ee16 commit b7ed23d
Show file tree
Hide file tree
Showing 69 changed files with 1,467 additions and 357 deletions.
6 changes: 0 additions & 6 deletions .changeset/blocker-key-strict-mode.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/decode-hash-scroll.md
@@ -0,0 +1,5 @@
---
"react-router-dom": patch
---

Properly decode element id when emulating hash scrolling via `<ScrollRestoration>`
5 changes: 5 additions & 0 deletions .changeset/defer-resolve-undefined.md
@@ -0,0 +1,5 @@
---
"@remix-run/router": patch
---

Better handling of deferred promises that resolve/reject with `undefined`
5 changes: 5 additions & 0 deletions .changeset/fetcher-redirect-interrupt.md
@@ -0,0 +1,5 @@
---
"@remix-run/router": patch
---

Properly handle fetcher redirects interrupted by normal navigations
5 changes: 5 additions & 0 deletions .changeset/form-state-prop.md
@@ -0,0 +1,5 @@
---
"react-router-dom": patch
---

Add missing `<Form state>` prop to populate `history.state` on submission navigations
5 changes: 0 additions & 5 deletions .changeset/formdata-submitter.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/hydrate-error-type.md
@@ -0,0 +1,5 @@
---
"react-router-dom": patch
---

Support proper hydration of `Error` subclasses such as `ReferenceError`/`TypeError`
5 changes: 5 additions & 0 deletions .changeset/initial-load-fetcher.md
@@ -0,0 +1,5 @@
---
"@remix-run/router": patch
---

Initial-load fetchers should not automatically revalidate on GET navigations
5 changes: 5 additions & 0 deletions .changeset/prompt-effect-order.md
@@ -0,0 +1,5 @@
---
"react-router-dom": patch
---

Reorder effects in `unstable_usePrompt` to avoid throwing an exception if the prompt is unblocked and a navigation is performed syncronously
5 changes: 0 additions & 5 deletions .changeset/purple-islands-cough.md

This file was deleted.

44 changes: 0 additions & 44 deletions .changeset/raw-payload-submission-router.md

This file was deleted.

55 changes: 0 additions & 55 deletions .changeset/raw-payload-submission.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/route-lazy-type.md
@@ -0,0 +1,5 @@
---
"@remix-run/router": patch
---

Enhance the return type of `Route.lazy` to prohibit returning an empty object
9 changes: 0 additions & 9 deletions .changeset/smart-pots-repair.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/strip-basename-getkey.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/strip-blocker-basename.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/sync-window-location.md

This file was deleted.

12 changes: 6 additions & 6 deletions DEVELOPMENT.md
Expand Up @@ -4,7 +4,7 @@

New releases should be created from release branches originating from the `dev` branch. When you are ready to begin the release process:

- Make sure you've pulled all of the changes from GitHub for both `dev` and `main` branches.
- Make sure you've pulled all the changes from GitHub for both `dev` and `main` branches.
- Check out the `dev` branch.
- Create a new release branch with the `release-` prefix (eg, `git checkout -b release-next`).
- **IMPORTANT:** The `release-` prefix is important, as this is what triggers our GitHub CI workflow that will ultimately publish the release.
Expand All @@ -17,7 +17,7 @@ Changesets will do most of the heavy lifting for our releases. When changes are

- Ensure you are on the new `release-*` branch.
- Enter Changesets pre-release mode using the `pre` tag: `yarn changeset pre enter pre`.
- Commit the change and push the the `release-*` branch to GitHub.
- Commit the change and push the `release-*` branch to GitHub.
- Wait for the release workflow to finish. The Changesets action in the workflow will open a PR that will increment all versions and generate the changelogs.
- Review the updated `CHANGELOG` files and make any adjustments necessary, then merge the PR into the `release-*` branch.
- `find packages -name 'CHANGELOG.md' -mindepth 2 -maxdepth 2 -exec code {} \;`
Expand All @@ -30,27 +30,27 @@ You may need to make changes to a pre-release prior to publishing a final stable
- Make whatever changes you need.
- Create a new changeset: `yarn changeset`.
- **IMPORTANT:** This is required even if you ultimately don't want to include these changes in the logs. Remember, changelogs can be edited prior to publishing, but the Changeset version script needs to see new changesets in order to create a new version.
- Commit the changesets and push the the `release-*` branch to GitHub.
- Commit the changesets and push the `release-*` branch to GitHub.
- Wait for the release workflow to finish and the Changesets action to open its PR that will increment all versions.
- Review the PR, make any adjustments necessary, and merge it into the `release-*` branch.
- Once the PR is merged, the release workflow will publish the updated packages to npm.

### Publishing the stable release

- Exit Changesets pre-release mode: `yarn changeset pre exit`.
- Commit the edited pre-release file along with any unpublished changesets, and push the the `release-*` branch to GitHub.
- Commit the edited pre-release file along with any unpublished changesets, and push the `release-*` branch to GitHub.
- Wait for the release workflow to finish. The Changesets action in the workflow will open a PR that will increment all versions and generate the changelogs for the stable release.
- Review the updated `CHANGELOG` files and make any adjustments necessary.
- We should remove the changelogs for all pre-releases ahead of publishing the stable version.
- [TODO: We should automate this]
- Prepare the github release notes
- Prepare the GitHub release notes
- Copy the relevant changelog entries from all packages into the Release Notes and adjust accordingly, matching the format used by prior releases
- Merge the PR into the `release-*` branch.
- Once the PR is merged, the release workflow will publish the updated packages to npm.
- Once the release is published:
- merge the `release-*` branch into `main` and push it up to GitHub
- merge the `release-*` branch into `dev` and push it up to GitHub
- Convert the `react-router@6.x.y` tag to a Release on Github with the name `v6.x.y`
- Convert the `react-router@6.x.y` tag to a Release on GitHub with the name `v6.x.y`

### Hotfix releases

Expand Down
7 changes: 6 additions & 1 deletion contributors.yml
@@ -1,5 +1,6 @@
- 0xEddie
- abdallah-nour
- abeadam
- abhi-kr-2100
- AchThomas
- adamdotjs
Expand All @@ -16,6 +17,7 @@
- andreiduca
- antonmontrezor
- appden
- arjunyel
- arnassavickas
- aroyan
- avipatel97
Expand Down Expand Up @@ -74,6 +76,7 @@
- GuptaSiddhant
- haivuw
- hernanif1
- holynewbie
- hongji00
- hsbtr
- hyesungoh
Expand Down Expand Up @@ -139,6 +142,7 @@
- markivancho
- maruffahmed
- marvinruder
- mathpaquette
- matt-harro
- maxpou
- mcansh
Expand Down Expand Up @@ -218,5 +222,6 @@
- yionr
- yuleicul
- zheng-chuang
- holynewbie
- smithki
- istarkov
- louis-young
19 changes: 19 additions & 0 deletions docs/components/form.md
Expand Up @@ -215,6 +215,24 @@ See also:
- [`useActionData`][useactiondata]
- [`useSubmit`][usesubmit]

## `state`

The `state` property can be used to set a stateful value for the new location which is stored inside [history state][history-state]. This value can subsequently be accessed via `useLocation()`.

```tsx
<Form
method="post"
action="new-path"
state={{ some: "value" }}
/>
```

You can access this state value while on the "new-path" route:

```ts
let { state } = useLocation();
```

## `preventScrollReset`

If you are using [`<ScrollRestoration>`][scrollrestoration], this lets you prevent the scroll position from being reset to the top of the window when the form action redirects to a new location.
Expand Down Expand Up @@ -330,3 +348,4 @@ You can access those values from the `request.url`
[pickingarouter]: ../routers/picking-a-router
[scrollrestoration]: ./scroll-restoration
[link-preventscrollreset]: ./link#preventscrollreset
[history-state]: https://developer.mozilla.org/en-US/docs/Web/API/History/state
31 changes: 25 additions & 6 deletions docs/hooks/use-submit.md
Expand Up @@ -96,28 +96,44 @@ submit([
]);
```

The default behavior if you submit a JSON object is to encode the data into `FormData`:
The default behavior if you submit a JSON object for a POST submission is to encode the data into `FormData`:

```tsx
submit({ key: "value" });
submit(
{ key: "value" },
{
method: "post",
encType: "application/x-www-form-urlencoded",
}
);
// will serialize into request.formData() in your action
// and will show up on useNavigation().formData during the navigation
```

Or you can opt-into JSON encoding:

```tsx
submit({ key: "value" }, { encType: "application/json" });
submit(
{ key: "value" },
{ method: "post", encType: "application/json" }
);
// will serialize into request.json() in your action
// and will show up on useNavigation().json during the navigation

submit('{"key":"value"}', { encType: "application/json" });
submit('{"key":"value"}', {
method: "post",
encType: "application/json",
});
// will encode into request.json() in your action
// and will show up on useNavigation().json during the navigation
```

Or plain text:

```tsx
submit("value", { encType: "text/plain" });
submit("value", { method: "post", encType: "text/plain" });
// will serialize into request.text() in your action
// and will show up on useNavigation().text during the navigation
```

## Submit options
Expand All @@ -126,12 +142,15 @@ The second argument is a set of options that map (mostly) directly to form submi

```tsx
submit(null, {
action: "/logout",
method: "post",
action: "/logout",
});

// same as
<Form action="/logout" method="post" />;
```

Because submissions are navigations, the options may also contain the other navigation related props from [`<Form>`][form] such as `replace`, `state`, `preventScrollReset`, `relative`, etc.

[pickingarouter]: ../routers/picking-a-router
[form]: ../components/form.md
2 changes: 1 addition & 1 deletion docs/routers/picking-a-router.md
Expand Up @@ -57,7 +57,7 @@ ReactDOM.createRoot(document.getElementById("root")).render(

We recommend all web projects use [`createBrowserRouter`][createbrowserrouter].

It uses the full URL instead of the hash urls (`#this/stuff`) common in web apps before `window.pushState` was standardized. Full URLs are better for SEO, better for server rendering, and are just more compatible with the rest of the web platform.
It uses the full URL instead of the hash urls (`#this/stuff`) common in web apps before `history.pushState` was standardized. Full URLs are better for SEO, better for server rendering, and are just more compatible with the rest of the web platform.

If you're hosting your app on a static file server, you'll need to configure it to send all requests to your `index.html` to avoid getting 404s.

Expand Down

0 comments on commit b7ed23d

Please sign in to comment.