diff --git a/CHANGELOG.md b/CHANGELOG.md index 592c94c202..9039ebac65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,152 +13,154 @@ We manage release notes in this file instead of the paginated Github Releases Pa Table of Contents - [React Router Releases](#react-router-releases) + - [v6.23.1](#v6231) + - [Patch Changes](#patch-changes) - [v6.23.0](#v6230) - [What's Changed](#whats-changed) - [Data Strategy (unstable)](#data-strategy-unstable) - [Skip Action Error Revalidation (unstable)](#skip-action-error-revalidation-unstable) - [Minor Changes](#minor-changes) - [v6.22.3](#v6223) - - [Patch Changes](#patch-changes) - - [v6.22.2](#v6222) - [Patch Changes](#patch-changes-1) - - [v6.22.1](#v6221) + - [v6.22.2](#v6222) - [Patch Changes](#patch-changes-2) + - [v6.22.1](#v6221) + - [Patch Changes](#patch-changes-3) - [v6.22.0](#v6220) - [What's Changed](#whats-changed-1) - [Core Web Vitals Technology Report Flag](#core-web-vitals-technology-report-flag) - [Minor Changes](#minor-changes-1) - - [Patch Changes](#patch-changes-3) - - [v6.21.3](#v6213) - [Patch Changes](#patch-changes-4) - - [v6.21.2](#v6212) + - [v6.21.3](#v6213) - [Patch Changes](#patch-changes-5) - - [v6.21.1](#v6211) + - [v6.21.2](#v6212) - [Patch Changes](#patch-changes-6) + - [v6.21.1](#v6211) + - [Patch Changes](#patch-changes-7) - [v6.21.0](#v6210) - [What's Changed](#whats-changed-2) - [`future.v7_relativeSplatPath`](#futurev7_relativesplatpath) - [Partial Hydration](#partial-hydration) - [Minor Changes](#minor-changes-2) - - [Patch Changes](#patch-changes-7) - - [v6.20.1](#v6201) - [Patch Changes](#patch-changes-8) + - [v6.20.1](#v6201) + - [Patch Changes](#patch-changes-9) - [v6.20.0](#v6200) - [Minor Changes](#minor-changes-3) - - [Patch Changes](#patch-changes-9) + - [Patch Changes](#patch-changes-10) - [v6.19.0](#v6190) - [What's Changed](#whats-changed-3) - [`unstable_flushSync` API](#unstable_flushsync-api) - [Minor Changes](#minor-changes-4) - - [Patch Changes](#patch-changes-10) + - [Patch Changes](#patch-changes-11) - [v6.18.0](#v6180) - [What's Changed](#whats-changed-4) - [New Fetcher APIs](#new-fetcher-apis) - [Persistence Future Flag (`future.v7_fetcherPersist`)](#persistence-future-flag-futurev7_fetcherpersist) - [Minor Changes](#minor-changes-5) - - [Patch Changes](#patch-changes-11) + - [Patch Changes](#patch-changes-12) - [v6.17.0](#v6170) - [What's Changed](#whats-changed-5) - [View Transitions 🚀](#view-transitions-) - [Minor Changes](#minor-changes-6) - - [Patch Changes](#patch-changes-12) + - [Patch Changes](#patch-changes-13) - [v6.16.0](#v6160) - [Minor Changes](#minor-changes-7) - - [Patch Changes](#patch-changes-13) + - [Patch Changes](#patch-changes-14) - [v6.15.0](#v6150) - [Minor Changes](#minor-changes-8) - - [Patch Changes](#patch-changes-14) - - [v6.14.2](#v6142) - [Patch Changes](#patch-changes-15) - - [v6.14.1](#v6141) + - [v6.14.2](#v6142) - [Patch Changes](#patch-changes-16) + - [v6.14.1](#v6141) + - [Patch Changes](#patch-changes-17) - [v6.14.0](#v6140) - [What's Changed](#whats-changed-6) - [JSON/Text Submissions](#jsontext-submissions) - [Minor Changes](#minor-changes-9) - - [Patch Changes](#patch-changes-17) + - [Patch Changes](#patch-changes-18) - [v6.13.0](#v6130) - [What's Changed](#whats-changed-7) - [Minor Changes](#minor-changes-10) - - [Patch Changes](#patch-changes-18) - - [v6.12.1](#v6121) - [Patch Changes](#patch-changes-19) + - [v6.12.1](#v6121) + - [Patch Changes](#patch-changes-20) - [v6.12.0](#v6120) - [What's Changed](#whats-changed-8) - [`React.startTransition` support](#reactstarttransition-support) - [Minor Changes](#minor-changes-11) - - [Patch Changes](#patch-changes-20) - - [v6.11.2](#v6112) - [Patch Changes](#patch-changes-21) - - [v6.11.1](#v6111) + - [v6.11.2](#v6112) - [Patch Changes](#patch-changes-22) + - [v6.11.1](#v6111) + - [Patch Changes](#patch-changes-23) - [v6.11.0](#v6110) - [Minor Changes](#minor-changes-12) - - [Patch Changes](#patch-changes-23) + - [Patch Changes](#patch-changes-24) - [v6.10.0](#v6100) - [What's Changed](#whats-changed-9) - [Minor Changes](#minor-changes-13) - - [Patch Changes](#patch-changes-24) + - [Patch Changes](#patch-changes-25) - [v6.9.0](#v690) - [What's Changed](#whats-changed-10) - [`Component`/`ErrorBoundary` route properties](#componenterrorboundary-route-properties) - [Introducing Lazy Route Modules](#introducing-lazy-route-modules) - [Minor Changes](#minor-changes-14) - - [Patch Changes](#patch-changes-25) - - [v6.8.2](#v682) - [Patch Changes](#patch-changes-26) - - [v6.8.1](#v681) + - [v6.8.2](#v682) - [Patch Changes](#patch-changes-27) + - [v6.8.1](#v681) + - [Patch Changes](#patch-changes-28) - [v6.8.0](#v680) - [Minor Changes](#minor-changes-15) - - [Patch Changes](#patch-changes-28) + - [Patch Changes](#patch-changes-29) - [v6.7.0](#v670) - [Minor Changes](#minor-changes-16) - - [Patch Changes](#patch-changes-29) - - [v6.6.2](#v662) - [Patch Changes](#patch-changes-30) - - [v6.6.1](#v661) + - [v6.6.2](#v662) - [Patch Changes](#patch-changes-31) + - [v6.6.1](#v661) + - [Patch Changes](#patch-changes-32) - [v6.6.0](#v660) - [What's Changed](#whats-changed-11) - [Minor Changes](#minor-changes-17) - - [Patch Changes](#patch-changes-32) + - [Patch Changes](#patch-changes-33) - [v6.5.0](#v650) - [What's Changed](#whats-changed-12) - [Minor Changes](#minor-changes-18) - - [Patch Changes](#patch-changes-33) - - [v6.4.5](#v645) - [Patch Changes](#patch-changes-34) - - [v6.4.4](#v644) + - [v6.4.5](#v645) - [Patch Changes](#patch-changes-35) - - [v6.4.3](#v643) + - [v6.4.4](#v644) - [Patch Changes](#patch-changes-36) - - [v6.4.2](#v642) + - [v6.4.3](#v643) - [Patch Changes](#patch-changes-37) - - [v6.4.1](#v641) + - [v6.4.2](#v642) - [Patch Changes](#patch-changes-38) + - [v6.4.1](#v641) + - [Patch Changes](#patch-changes-39) - [v6.4.0](#v640) - [What's Changed](#whats-changed-13) - [Remix Data APIs](#remix-data-apis) - - [Patch Changes](#patch-changes-39) + - [Patch Changes](#patch-changes-40) - [v6.3.0](#v630) - [Minor Changes](#minor-changes-19) - [v6.2.2](#v622) - - [Patch Changes](#patch-changes-40) - - [v6.2.1](#v621) - [Patch Changes](#patch-changes-41) + - [v6.2.1](#v621) + - [Patch Changes](#patch-changes-42) - [v6.2.0](#v620) - [Minor Changes](#minor-changes-20) - - [Patch Changes](#patch-changes-42) - - [v6.1.1](#v611) - [Patch Changes](#patch-changes-43) + - [v6.1.1](#v611) + - [Patch Changes](#patch-changes-44) - [v6.1.0](#v610) - [Minor Changes](#minor-changes-21) - - [Patch Changes](#patch-changes-44) - - [v6.0.2](#v602) - [Patch Changes](#patch-changes-45) - - [v6.0.1](#v601) + - [v6.0.2](#v602) - [Patch Changes](#patch-changes-46) + - [v6.0.1](#v601) + - [Patch Changes](#patch-changes-47) - [v6.0.0](#v600) @@ -182,6 +184,19 @@ Date: YYYY-MM-DD **Full Changelog**: [`v6.X.Y...v6.X.Y`](https://github.com/remix-run/react-router/compare/react-router@6.X.Y...react-router@6.X.Y) --> +## v6.23.1 + +Date: 2024-05-10 + +### Patch Changes + +- Allow `undefined` to be resolved through `` ([#11513](https://github.com/remix-run/react-router/pull/11513)) +- Add defensive `document` check when checking for `document.startViewTransition` availability ([#11544](https://github.com/remix-run/react-router/pull/11544)) +- Change the `react-router-dom/server` import back to `react-router-dom` instead of `index.ts` ([#11514](https://github.com/remix-run/react-router/pull/11514)) +- `@remix-run/router` - Support `unstable_dataStrategy` on `staticHandler.queryRoute` ([#11515](https://github.com/remix-run/react-router/pull/11515)) + +**Full Changelog**: [`v6.23.0...v6.23.1`](https://github.com/remix-run/react-router/compare/react-router@6.23.0...react-router@6.23.1) + ## v6.23.0 Date: 2024-04-23 diff --git a/contributors.yml b/contributors.yml index f52afd54ec..398f8a82b5 100644 --- a/contributors.yml +++ b/contributors.yml @@ -242,6 +242,7 @@ - tlinhart - tom-sherman - tomasr8 +- TooTallNate - triangularcube - trungpv1601 - turansky diff --git a/packages/react-router-dom-v5-compat/CHANGELOG.md b/packages/react-router-dom-v5-compat/CHANGELOG.md index ee5bac22db..d2a01670a8 100644 --- a/packages/react-router-dom-v5-compat/CHANGELOG.md +++ b/packages/react-router-dom-v5-compat/CHANGELOG.md @@ -1,5 +1,14 @@ # `react-router-dom-v5-compat` +## 6.23.1 + +### Patch Changes + +- Updated dependencies: + - `@remix-run/router@1.16.1` + - `react-router-dom@6.23.1` + - `react-router@6.23.1` + ## 6.23.0 ### Minor Changes diff --git a/packages/react-router-dom-v5-compat/package.json b/packages/react-router-dom-v5-compat/package.json index cccca5fe5d..3d1be4b8e2 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.23.0", + "version": "6.23.1", "description": "Migration path to React Router v6 from v4/5", "keywords": [ "react", diff --git a/packages/react-router-dom/CHANGELOG.md b/packages/react-router-dom/CHANGELOG.md index c19bc004b8..ffa5a9f3b2 100644 --- a/packages/react-router-dom/CHANGELOG.md +++ b/packages/react-router-dom/CHANGELOG.md @@ -1,5 +1,15 @@ # `react-router-dom` +## 6.23.1 + +### Patch Changes + +- Check for `document` existence when checking `startViewTransition` ([#11544](https://github.com/remix-run/react-router/pull/11544)) +- Change the `react-router-dom/server` import back to `react-router-dom` instead of `index.ts` ([#11514](https://github.com/remix-run/react-router/pull/11514)) +- Updated dependencies: + - `@remix-run/router@1.16.1` + - `react-router@6.23.1` + ## 6.23.0 ### Minor Changes diff --git a/packages/react-router-dom/index.tsx b/packages/react-router-dom/index.tsx index 1d4675396e..1f2e515f75 100644 --- a/packages/react-router-dom/index.tsx +++ b/packages/react-router-dom/index.tsx @@ -526,6 +526,7 @@ export function RouterProvider({ let isViewTransitionUnavailable = router.window == null || + router.window.document == null || typeof router.window.document.startViewTransition !== "function"; // If this isn't a view transition or it's not available in this browser, diff --git a/packages/react-router-dom/package.json b/packages/react-router-dom/package.json index 407c913a5d..c0df38a090 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.23.0", + "version": "6.23.1", "description": "Declarative routing for React web applications", "keywords": [ "react", diff --git a/packages/react-router-dom/server.tsx b/packages/react-router-dom/server.tsx index 3195c3d271..9fcb91b173 100644 --- a/packages/react-router-dom/server.tsx +++ b/packages/react-router-dom/server.tsx @@ -29,7 +29,7 @@ import type { Location, RouteObject, To, -} from "./index"; +} from "react-router-dom"; import { createPath, parsePath, @@ -38,7 +38,7 @@ import { UNSAFE_DataRouterStateContext as DataRouterStateContext, UNSAFE_FetchersContext as FetchersContext, UNSAFE_ViewTransitionContext as ViewTransitionContext, -} from "./index"; +} from "react-router-dom"; export interface StaticRouterProps { basename?: string; diff --git a/packages/react-router-dom/tsconfig.json b/packages/react-router-dom/tsconfig.json index a84a59018c..c01508b4ef 100644 --- a/packages/react-router-dom/tsconfig.json +++ b/packages/react-router-dom/tsconfig.json @@ -16,6 +16,12 @@ "skipLibCheck": true, "outDir": ".", - "rootDir": "." + "rootDir": ".", + + // Needed for the more-strict pnpm setup, can be removed in v7 since we'll + // be collapsing the lifted server file into the main package export + "paths": { + "react-router-dom": ["./index.tsx"] + } } } diff --git a/packages/react-router-native/CHANGELOG.md b/packages/react-router-native/CHANGELOG.md index 5da49a7c3d..c7cf07c35f 100644 --- a/packages/react-router-native/CHANGELOG.md +++ b/packages/react-router-native/CHANGELOG.md @@ -1,5 +1,12 @@ # `react-router-native` +## 6.23.1 + +### Patch Changes + +- Updated dependencies: + - `react-router@6.23.1` + ## 6.23.0 ### Minor Changes diff --git a/packages/react-router-native/package.json b/packages/react-router-native/package.json index adfe7b83a1..6226d7a219 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.23.0", + "version": "6.23.1", "description": "Declarative routing for React Native applications", "keywords": [ "react", diff --git a/packages/react-router/CHANGELOG.md b/packages/react-router/CHANGELOG.md index 53b8b016ad..6a595543b3 100644 --- a/packages/react-router/CHANGELOG.md +++ b/packages/react-router/CHANGELOG.md @@ -1,5 +1,13 @@ # `react-router` +## 6.23.1 + +### Patch Changes + +- allow undefined to be resolved with `` ([#11513](https://github.com/remix-run/react-router/pull/11513)) +- Updated dependencies: + - `@remix-run/router@1.16.1` + ## 6.23.0 ### Minor Changes diff --git a/packages/react-router/__tests__/data-memory-router-test.tsx b/packages/react-router/__tests__/data-memory-router-test.tsx index 4a4826dd2c..db9dd488ad 100644 --- a/packages/react-router/__tests__/data-memory-router-test.tsx +++ b/packages/react-router/__tests__/data-memory-router-test.tsx @@ -3089,6 +3089,35 @@ describe("createMemoryRouter", () => { `); }); + it("can render raw resolved to undefined promises with ", async () => { + let dfd = createDeferred(); + + let { container } = render( + Loading...

}> + {(data) =>

{String(data)}

}
+
+ ); + + console.log(getHtml(container)); + expect(getHtml(container)).toMatchInlineSnapshot(` + "
+

+ Loading... +

+
" + `); + + dfd.resolve(undefined); + await waitFor(() => screen.getByText("undefined")); + expect(getHtml(container)).toMatchInlineSnapshot(` + "
+

+ undefined +

+
" + `); + }); + it("can render raw resolved promises with ", async () => { let dfd = createDeferred(); diff --git a/packages/react-router/lib/components.tsx b/packages/react-router/lib/components.tsx index 918bc34d39..958cb5a773 100644 --- a/packages/react-router/lib/components.tsx +++ b/packages/react-router/lib/components.tsx @@ -590,9 +590,9 @@ class AwaitErrorBoundary extends React.Component< // Already tracked promise - check contents promise = resolve; status = - promise._error !== undefined + "_error" in promise ? AwaitRenderStatus.error - : promise._data !== undefined + : "_data" in promise ? AwaitRenderStatus.success : AwaitRenderStatus.pending; } else { diff --git a/packages/react-router/package.json b/packages/react-router/package.json index 692a6b3a71..9305a2d1b6 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -1,6 +1,6 @@ { "name": "react-router", - "version": "6.23.0", + "version": "6.23.1", "description": "Declarative routing for React", "keywords": [ "react", diff --git a/packages/router/CHANGELOG.md b/packages/router/CHANGELOG.md index f63876348a..32ebe56d45 100644 --- a/packages/router/CHANGELOG.md +++ b/packages/router/CHANGELOG.md @@ -1,5 +1,11 @@ # `@remix-run/router` +## 1.16.1 + +### Patch Changes + +- Support `unstable_dataStrategy` on `staticHandler.queryRoute` ([#11515](https://github.com/remix-run/react-router/pull/11515)) + ## 1.16.0 ### Minor Changes diff --git a/packages/router/__tests__/ssr-test.ts b/packages/router/__tests__/ssr-test.ts index 7795c08f70..df7c1882b5 100644 --- a/packages/router/__tests__/ssr-test.ts +++ b/packages/router/__tests__/ssr-test.ts @@ -2628,5 +2628,18 @@ describe("ssr", () => { /* eslint-enable jest/no-conditional-expect */ }); + + describe("router dataStrategy", () => { + it("should apply a custom data strategy", async () => { + let { queryRoute } = createStaticHandler(SSR_ROUTES); + let data; + + data = await queryRoute(createRequest("/custom"), { + unstable_dataStrategy: urlDataStrategy, + }); + expect(data).toBeInstanceOf(URLSearchParams); + expect((data as URLSearchParams).get("foo")).toBe("bar"); + }); + }); }); }); diff --git a/packages/router/package.json b/packages/router/package.json index 2560dadb8d..95b7e368a6 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -1,6 +1,6 @@ { "name": "@remix-run/router", - "version": "1.16.0", + "version": "1.16.1", "description": "Nested/Data-driven/Framework-agnostic Routing", "keywords": [ "remix", diff --git a/packages/router/router.ts b/packages/router/router.ts index 7a7d2c0a61..b72cb70091 100644 --- a/packages/router/router.ts +++ b/packages/router/router.ts @@ -412,7 +412,11 @@ export interface StaticHandler { ): Promise; queryRoute( request: Request, - opts?: { routeId?: string; requestContext?: unknown } + opts?: { + routeId?: string; + requestContext?: unknown; + unstable_dataStrategy?: DataStrategyFunction; + } ): Promise; } @@ -3099,7 +3103,12 @@ export function createStaticHandler( { routeId, requestContext, - }: { requestContext?: unknown; routeId?: string } = {} + unstable_dataStrategy, + }: { + requestContext?: unknown; + routeId?: string; + unstable_dataStrategy?: DataStrategyFunction; + } = {} ): Promise { let url = new URL(request.url); let method = request.method; @@ -3132,7 +3141,7 @@ export function createStaticHandler( location, matches, requestContext, - null, + unstable_dataStrategy || null, false, match );