From ca0edff2cfdffbe7361c6e46b70b5ddbb470c952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Wed, 8 Mar 2023 01:23:13 +0100 Subject: [PATCH 1/2] feat(remix-react): show deprecation warning when `imagesizes` & `imagesizes` properties are returned from `links` function --- .changeset/thick-actors-juggle.md | 5 +++++ packages/remix-react/components.tsx | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .changeset/thick-actors-juggle.md diff --git a/.changeset/thick-actors-juggle.md b/.changeset/thick-actors-juggle.md new file mode 100644 index 00000000000..b9351909b45 --- /dev/null +++ b/.changeset/thick-actors-juggle.md @@ -0,0 +1,5 @@ +--- +"@remix-run/react": minor +--- + +show deprecation warning when `imagesizes` & `imagesizes` properties are returned from `links` function diff --git a/packages/remix-react/components.tsx b/packages/remix-react/components.tsx index dffce5c9a9d..8148cb568dd 100644 --- a/packages/remix-react/components.tsx +++ b/packages/remix-react/components.tsx @@ -383,6 +383,16 @@ export function Links() { [matches, routeModules, manifest] ); + React.useEffect(() => { + warnOnce( + links.some((link) => "imagesizes" in link || "imagesrcset" in link), + "⚠️ DEPRECATED: The `imagesizes` & `imagesrcset` properties in " + + "your links have been deprecated in favor of `imageSizes` & " + + "`imageSrcSet` and support will be removed in Remix v2. Please update " + + "your code to use the new property names instead." + ); + }, [links]); + return ( <> {links.map((link) => { From b72bc8c6a506aa6c0eab3c0a68013f0d180fad8b Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Tue, 21 Mar 2023 15:45:33 -0400 Subject: [PATCH 2/2] Filter deprecation logs from integration tests assertions --- integration/action-test.ts | 5 ++++- integration/defer-test.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/integration/action-test.ts b/integration/action-test.ts index dee315b2a55..bde3c0c32a4 100644 --- a/integration/action-test.ts +++ b/integration/action-test.ts @@ -109,7 +109,10 @@ test.describe("actions", () => { test.beforeEach(({ page }) => { page.on("console", (msg) => { - logs.push(msg.text()); + let text = msg.text(); + if (!/DEPRECATED.*imagesizes.*imagesrcset/.test(text)) { + logs.push(text); + } }); }); diff --git a/integration/defer-test.ts b/integration/defer-test.ts index edac58789e1..cd8f88e11e2 100644 --- a/integration/defer-test.ts +++ b/integration/defer-test.ts @@ -1287,7 +1287,8 @@ function monitorConsole(page: Page) { let arg0 = await args[0].jsonValue(); if ( typeof arg0 === "string" && - arg0.includes("Download the React DevTools") + (arg0.includes("Download the React DevTools") || + /DEPRECATED.*imagesizes.*imagesrcset/.test(arg0)) ) { continue; }