@@ -52,7 +52,6 @@ import type {
52
52
V2_MetaMatch ,
53
53
V2_MetaMatches ,
54
54
} from "./routeModules" ;
55
- import { logDeprecationOnce } from "./warnings" ;
56
55
57
56
function useDataRouterContext ( ) {
58
57
let context = React . useContext ( DataRouterContext ) ;
@@ -314,12 +313,6 @@ export function composeEventHandlers<
314
313
} ;
315
314
}
316
315
317
- let linksWarning =
318
- "⚠️ REMIX FUTURE CHANGE: The behavior of links `imagesizes` and `imagesrcset` will be changing in v2. " +
319
- "Only the React camel case versions will be valid. Please change to `imageSizes` and `imageSrcSet`. " +
320
- "For instructions on making this change see " +
321
- "https://remix.run/docs/en/v1.15.0/pages/v2#links-imagesizes-and-imagesrcset" ;
322
-
323
316
/**
324
317
* Renders the `<link>` tags for the current routes.
325
318
*
@@ -341,12 +334,6 @@ export function Links() {
341
334
[ matches , routeModules , manifest ]
342
335
) ;
343
336
344
- React . useEffect ( ( ) => {
345
- if ( links . some ( ( link ) => "imagesizes" in link || "imagesrcset" in link ) ) {
346
- logDeprecationOnce ( linksWarning ) ;
347
- }
348
- } , [ links ] ) ;
349
-
350
337
return (
351
338
< >
352
339
{ links . map ( ( link ) => {
@@ -355,37 +342,32 @@ export function Links() {
355
342
}
356
343
357
344
let imageSrcSet : string | null = null ;
345
+ let imageSizes : string | null = null ;
358
346
359
347
// In React 17, <link imageSrcSet> and <link imageSizes> will warn
360
348
// because the DOM attributes aren't recognized, so users need to pass
361
349
// them in all lowercase to forward the attributes to the node without a
362
350
// warning. Normalize so that either property can be used in Remix.
363
- if ( "useId" in React ) {
364
- if ( link . imagesrcset ) {
365
- link . imageSrcSet = imageSrcSet = link . imagesrcset ;
366
- delete link . imagesrcset ;
367
- }
368
-
369
- if ( link . imagesizes ) {
370
- link . imageSizes = link . imagesizes ;
371
- delete link . imagesizes ;
372
- }
373
- } else {
374
- if ( link . imageSrcSet ) {
375
- link . imagesrcset = imageSrcSet = link . imageSrcSet ;
376
- delete link . imageSrcSet ;
377
- }
351
+ let imageSizesKey = "useId" in React ? "imageSizes" : "imagesizes" ;
352
+ let imageSrcSetKey = "useId" in React ? "imageSrcSet" : "imagesrcset" ;
353
+ if ( link . imageSrcSet ) {
354
+ imageSrcSet = link . imageSrcSet ;
355
+ delete link . imageSrcSet ;
356
+ }
378
357
379
- if ( link . imageSizes ) {
380
- link . imagesizes = link . imageSizes ;
381
- delete link . imageSizes ;
382
- }
358
+ if ( link . imageSizes ) {
359
+ imageSizes = link . imageSizes ;
360
+ delete link . imageSizes ;
383
361
}
384
362
385
363
return (
386
364
< link
387
365
key = { link . rel + ( link . href || "" ) + ( imageSrcSet || "" ) }
388
- { ...link }
366
+ { ...{
367
+ ...link ,
368
+ [ imageSizesKey ] : imageSizes ,
369
+ [ imageSrcSetKey ] : imageSrcSet ,
370
+ } }
389
371
/>
390
372
) ;
391
373
} ) }
0 commit comments