Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(remix-react): show deprecation warning when imagesizes & imagesizes properties are returned from links function #5706

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 4 additions & 1 deletion integration/action-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
});

Expand Down
3 changes: 2 additions & 1 deletion integration/defer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
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