Skip to content

Commit

Permalink
feat(remix-react): show deprecation warning when imagesizes & `imag…
Browse files Browse the repository at this point in the history
…esizes` properties are returned from `links` function
  • Loading branch information
MichaelDeBoey committed Mar 16, 2023
1 parent 4b70f9f commit eb5fe59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-actors-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/react": minor
---

show deprecation warning when `imagesizes` & `imagesizes` properties are returned from `links` function
10 changes: 10 additions & 0 deletions packages/remix-react/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit eb5fe59

Please sign in to comment.