diff --git a/.changeset/decode-hash-scroll.md b/.changeset/decode-hash-scroll.md deleted file mode 100644 index 212990fbba..0000000000 --- a/.changeset/decode-hash-scroll.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"react-router-dom": patch ---- - -Properly decode element id when emulating hash scrolling via `` diff --git a/.changeset/defer-resolve-undefined.md b/.changeset/defer-resolve-undefined.md deleted file mode 100644 index 2af79ce785..0000000000 --- a/.changeset/defer-resolve-undefined.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@remix-run/router": patch ---- - -Better handling of deferred promises that resolve/reject with `undefined` diff --git a/.changeset/fetcher-redirect-interrupt.md b/.changeset/fetcher-redirect-interrupt.md deleted file mode 100644 index ce36bc296c..0000000000 --- a/.changeset/fetcher-redirect-interrupt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@remix-run/router": patch ---- - -Properly handle fetcher redirects interrupted by normal navigations diff --git a/.changeset/form-state-prop.md b/.changeset/form-state-prop.md deleted file mode 100644 index fdedef6237..0000000000 --- a/.changeset/form-state-prop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"react-router-dom": patch ---- - -Add missing `
` prop to populate `history.state` on submission navigations diff --git a/.changeset/hydrate-error-type.md b/.changeset/hydrate-error-type.md deleted file mode 100644 index 674c77b2b9..0000000000 --- a/.changeset/hydrate-error-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"react-router-dom": patch ---- - -Support proper hydration of `Error` subclasses such as `ReferenceError`/`TypeError` diff --git a/.changeset/initial-load-fetcher.md b/.changeset/initial-load-fetcher.md deleted file mode 100644 index c30f500787..0000000000 --- a/.changeset/initial-load-fetcher.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@remix-run/router": patch ---- - -Initial-load fetchers should not automatically revalidate on GET navigations diff --git a/.changeset/route-lazy-type.md b/.changeset/route-lazy-type.md deleted file mode 100644 index 10ede70426..0000000000 --- a/.changeset/route-lazy-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@remix-run/router": patch ---- - -Enhance the return type of `Route.lazy` to prohibit returning an empty object diff --git a/contributors.yml b/contributors.yml index eda6c44c42..b0fc66fe83 100644 --- a/contributors.yml +++ b/contributors.yml @@ -208,6 +208,7 @@ - turansky - tyankatsu0105 - underager +- valerii15298 - ValiantCat - vijaypushkin - vikingviolinist diff --git a/docs/hooks/use-outlet-context.md b/docs/hooks/use-outlet-context.md index 222a0850a0..5b5794e008 100644 --- a/docs/hooks/use-outlet-context.md +++ b/docs/hooks/use-outlet-context.md @@ -49,7 +49,7 @@ export default function Dashboard() { return (

Dashboard

- +
); } diff --git a/package.json b/package.json index fb371bc83a..3333cdb849 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "none": "12.8 kB" }, "packages/react-router-dom/dist/umd/react-router-dom.production.min.js": { - "none": "18.7 kB" + "none": "18.71 kB" } } } diff --git a/packages/react-router-dom-v5-compat/CHANGELOG.md b/packages/react-router-dom-v5-compat/CHANGELOG.md index 6efd1151c3..d54d042acb 100644 --- a/packages/react-router-dom-v5-compat/CHANGELOG.md +++ b/packages/react-router-dom-v5-compat/CHANGELOG.md @@ -1,5 +1,13 @@ # `react-router-dom-v5-compat` +## 6.14.2 + +### Patch Changes + +- Updated dependencies: + - `react-router-dom@6.14.2` + - `react-router@6.14.2` + ## 6.14.1 ### Patch Changes diff --git a/packages/react-router-dom-v5-compat/package.json b/packages/react-router-dom-v5-compat/package.json index e0ebcef460..7ad4c9767c 100644 --- a/packages/react-router-dom-v5-compat/package.json +++ b/packages/react-router-dom-v5-compat/package.json @@ -1,6 +1,6 @@ { "name": "react-router-dom-v5-compat", - "version": "6.14.1", + "version": "6.14.2", "description": "Migration path to React Router v6 from v4/5", "keywords": [ "react", @@ -24,7 +24,7 @@ "types": "./dist/index.d.ts", "dependencies": { "history": "^5.3.0", - "react-router": "6.14.1" + "react-router": "6.14.2" }, "peerDependencies": { "react": ">=16.8", diff --git a/packages/react-router-dom/CHANGELOG.md b/packages/react-router-dom/CHANGELOG.md index d1597550f4..367b4f5381 100644 --- a/packages/react-router-dom/CHANGELOG.md +++ b/packages/react-router-dom/CHANGELOG.md @@ -1,5 +1,16 @@ # `react-router-dom` +## 6.14.2 + +### Patch Changes + +- Properly decode element id when emulating hash scrolling via `` ([#10682](https://github.com/remix-run/react-router/pull/10682)) +- Add missing `` prop to populate `history.state` on submission navigations ([#10630](https://github.com/remix-run/react-router/pull/10630)) +- Support proper hydration of `Error` subclasses such as `ReferenceError`/`TypeError` ([#10633](https://github.com/remix-run/react-router/pull/10633)) +- Updated dependencies: + - `@remix-run/router@1.7.2` + - `react-router@6.14.2` + ## 6.14.1 ### Patch Changes diff --git a/packages/react-router-dom/package.json b/packages/react-router-dom/package.json index 8034f6b242..faaf3ab18c 100644 --- a/packages/react-router-dom/package.json +++ b/packages/react-router-dom/package.json @@ -1,6 +1,6 @@ { "name": "react-router-dom", - "version": "6.14.1", + "version": "6.14.2", "description": "Declarative routing for React web applications", "keywords": [ "react", @@ -23,8 +23,8 @@ "module": "./dist/index.js", "types": "./dist/index.d.ts", "dependencies": { - "@remix-run/router": "1.7.1", - "react-router": "6.14.1" + "@remix-run/router": "1.7.2", + "react-router": "6.14.2" }, "devDependencies": { "react": "^18.2.0", diff --git a/packages/react-router-native/CHANGELOG.md b/packages/react-router-native/CHANGELOG.md index ca0716e02b..bd5fe8b307 100644 --- a/packages/react-router-native/CHANGELOG.md +++ b/packages/react-router-native/CHANGELOG.md @@ -1,5 +1,12 @@ # `react-router-native` +## 6.14.2 + +### Patch Changes + +- Updated dependencies: + - `react-router@6.14.2` + ## 6.14.1 ### Patch Changes diff --git a/packages/react-router-native/package.json b/packages/react-router-native/package.json index 76374b854b..1b827786b4 100644 --- a/packages/react-router-native/package.json +++ b/packages/react-router-native/package.json @@ -1,6 +1,6 @@ { "name": "react-router-native", - "version": "6.14.1", + "version": "6.14.2", "description": "Declarative routing for React Native applications", "keywords": [ "react", @@ -22,7 +22,7 @@ "types": "./dist/index.d.ts", "dependencies": { "@ungap/url-search-params": "^0.1.4", - "react-router": "6.14.1" + "react-router": "6.14.2" }, "devDependencies": { "react": "^18.2.0", diff --git a/packages/react-router/CHANGELOG.md b/packages/react-router/CHANGELOG.md index a03bff769f..3d8b8db45b 100644 --- a/packages/react-router/CHANGELOG.md +++ b/packages/react-router/CHANGELOG.md @@ -1,5 +1,12 @@ # `react-router` +## 6.14.2 + +### Patch Changes + +- Updated dependencies: + - `@remix-run/router@1.7.2` + ## 6.14.1 ### Patch Changes diff --git a/packages/react-router/package.json b/packages/react-router/package.json index eec3a3606d..903a6d4e2c 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -1,6 +1,6 @@ { "name": "react-router", - "version": "6.14.1", + "version": "6.14.2", "description": "Declarative routing for React", "keywords": [ "react", @@ -23,7 +23,7 @@ "module": "./dist/index.js", "types": "./dist/index.d.ts", "dependencies": { - "@remix-run/router": "1.7.1" + "@remix-run/router": "1.7.2" }, "devDependencies": { "react": "^18.2.0" diff --git a/packages/router/CHANGELOG.md b/packages/router/CHANGELOG.md index 88e12af19c..b97e755f13 100644 --- a/packages/router/CHANGELOG.md +++ b/packages/router/CHANGELOG.md @@ -1,5 +1,14 @@ # `@remix-run/router` +## 1.7.2 + +### Patch Changes + +- Trigger an error if a `defer` promise resolves/rejects with `undefined` in order to match the behavior of loaders and actions which must return a value or `null` ([#10690](https://github.com/remix-run/react-router/pull/10690)) +- Properly handle fetcher redirects interrupted by normal navigations ([#10674](https://github.com/remix-run/react-router/pull/10674), [#10709](https://github.com/remix-run/react-router/pull/10709)) +- Initial-load fetchers should not automatically revalidate on GET navigations ([#10688](https://github.com/remix-run/react-router/pull/10688)) +- Enhance the return type of `Route.lazy` to prohibit returning an empty object ([#10634](https://github.com/remix-run/react-router/pull/10634)) + ## 1.7.1 ### Patch Changes diff --git a/packages/router/__tests__/router-test.ts b/packages/router/__tests__/router-test.ts index 6a48cb2b3e..51fe38a0ff 100644 --- a/packages/router/__tests__/router-test.ts +++ b/packages/router/__tests__/router-test.ts @@ -10073,6 +10073,54 @@ describe("a router", () => { expect(t.router.state.fetchers.get(key)?.state).toBe("idle"); expect(t.router.state.fetchers.get(key)?.data).toBeUndefined(); }); + + it("ignores submission redirect navigation if preceded by a normal GET navigation (w/o loaders)", async () => { + let key = "key"; + let t = setup({ + routes: [ + { + path: "", + id: "root", + children: [ + { + path: "/", + id: "index", + }, + { + path: "/foo", + id: "foo", + action: true, + }, + { + path: "/bar", + id: "bar", + }, + { + path: "/baz", + id: "baz", + }, + ], + }, + ], + }); + let A = await t.fetch("/foo", key, { + formMethod: "post", + formData: createFormData({ key: "value" }), + }); + await t.navigate("/bar"); + + // This redirect should be ignored + await A.actions.foo.redirect("/baz"); + expect(t.router.state.fetchers.get(key)?.state).toBe("idle"); + + expect(t.router.state).toMatchObject({ + navigation: IDLE_NAVIGATION, + location: { pathname: "/bar" }, + loaderData: {}, + }); + expect(t.router.state.fetchers.get(key)?.state).toBe("idle"); + expect(t.router.state.fetchers.get(key)?.data).toBeUndefined(); + }); }); describe(` diff --git a/packages/router/package.json b/packages/router/package.json index fc1c078064..d52af7ce7f 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -1,6 +1,6 @@ { "name": "@remix-run/router", - "version": "1.7.1", + "version": "1.7.2", "description": "Nested/Data-driven/Framework-agnostic Routing", "keywords": [ "remix", diff --git a/packages/router/router.ts b/packages/router/router.ts index adae0211e0..ca7163d13b 100644 --- a/packages/router/router.ts +++ b/packages/router/router.ts @@ -1500,6 +1500,8 @@ export function createRouter(init: RouterInit): Router { (matchesToLoad && matchesToLoad.some((m) => m.route.id === routeId)) ); + pendingNavigationLoadId = ++incrementingLoadId; + // Short circuit if we have no loaders to run if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) { let updatedFetchers = markFetchRedirectsDone(); @@ -1541,7 +1543,6 @@ export function createRouter(init: RouterInit): Router { }); } - pendingNavigationLoadId = ++incrementingLoadId; revalidatingFetchers.forEach((rf) => { if (fetchControllers.has(rf.key)) { abortFetcher(rf.key);