From ba90c3a0d3b55086f0fdc8b5ea4cdaae772d17d2 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] 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 9f38e5918d2..760024d36fa 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) => {