From f5e79923b554c9eebcddee3da1cc5d4116c291a9 Mon Sep 17 00:00:00 2001 From: rouges78 Date: Mon, 23 Nov 2026 18:13:26 +0100 Subject: [PATCH] Move to React 19 Dependabot's #238 bumped react and @types/react alone, so npm ci failed with ERESOLVE: @types/react-dom 18 needs @types/react 18. This takes the whole set together: - react and react-dom 19.3.1 (published 2026-10-14), @types/react 19.3.0 and @types/react-dom 19.3.0 (2026-09-09). Next 15 accepts React 19. - csstype is held at 3.2.3 in the lockfile: npm picked 3.2.4, which is six days old, and @types/react only needs ^3.2.2. - react-day-picker 8 was the one dependency whose peer range stops at React 18. Its only user, components/ui/calendar.tsx, is imported nowhere and was already listed as dead in the dead-modules baseline, so both go instead of porting an unused component to v9. - Three type changes in React 19: useRef now needs an initial value (alphabet-background, use-batch-operations) and ErrorInfo.componentStack can be null (error-handler). No removed React 19 API (defaultProps on function components, propTypes, findDOMNode, ReactDOM.render, string refs, legacy context, react-dom/test-utils) is used. Co-Authored-By: Claude Opus 5.5 --- components/ui/alphabet-background.tsx | 2 +- components/ui/calendar.tsx | 70 ------------------- hooks/use-batch-operations.ts | 2 +- lib/error-handler.ts | 2 +- package-lock.json | 98 ++++++++------------------- package.json | 9 ++- scripts/.dead-modules-baseline.json | 1 - 7 files changed, 37 insertions(+), 147 deletions(-) delete mode 100644 components/ui/calendar.tsx diff --git a/components/ui/alphabet-background.tsx b/components/ui/alphabet-background.tsx index a2ac4cc5b..359943796 100644 --- a/components/ui/alphabet-background.tsx +++ b/components/ui/alphabet-background.tsx @@ -43,7 +43,7 @@ export function AlphabetBackground({ className = '' }: AlphabetBackgroundProps) { const canvasRef = useRef(null); - const animationRef = useRef(); + const animationRef = useRef(undefined); const lettersRef = useRef([]); // Genera lettere casuali diff --git a/components/ui/calendar.tsx b/components/ui/calendar.tsx deleted file mode 100644 index 4bb0fb04a..000000000 --- a/components/ui/calendar.tsx +++ /dev/null @@ -1,70 +0,0 @@ -'use client'; - -import * as React from 'react'; -import { ChevronLeft, ChevronRight } from 'lucide-react'; -import { DayPicker } from 'react-day-picker'; - -import { cn } from '@/lib/utils'; -import { buttonVariants } from '@/components/ui/button'; - -export type CalendarProps = React.ComponentProps; - -function Calendar({ - className, - classNames, - showOutsideDays = true, - ...props -}: CalendarProps) { - return ( - , - IconRight: ({ ..._props }) => , - }} - {...props} - /> - ); -} -Calendar.displayName = 'Calendar'; - -export { Calendar }; - - - - diff --git a/hooks/use-batch-operations.ts b/hooks/use-batch-operations.ts index 8271dc893..f76490128 100644 --- a/hooks/use-batch-operations.ts +++ b/hooks/use-batch-operations.ts @@ -37,7 +37,7 @@ export function useBatchOperations(options: UseBatchOperationsOptions = {}) { const [activeOperations, setActiveOperations] = useState([]); const [operationHistory, setOperationHistory] = useState([]); - const refreshIntervalRef = useRef(); + const refreshIntervalRef = useRef(undefined); const refreshActiveOperations = useCallback(async () => { try { diff --git a/lib/error-handler.ts b/lib/error-handler.ts index ec4e91f7c..d538d56af 100644 --- a/lib/error-handler.ts +++ b/lib/error-handler.ts @@ -314,7 +314,7 @@ export class ErrorHandler { const report = this.createErrorReport(error, { ...context, - componentStack: errorInfo?.componentStack + componentStack: errorInfo?.componentStack ?? undefined }); // Send to monitoring service in production diff --git a/package-lock.json b/package-lock.json index f9826b400..e43360d80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,9 +37,8 @@ "next": "^15.5.29", "next-themes": "0.4.6", "radix-ui": "^1.8.1", - "react": "^18.3.1", - "react-day-picker": "8.10.1", - "react-dom": "^18.3.1", + "react": "^19.3.1", + "react-dom": "^19.3.1", "react-virtuoso": "^4.18.22", "recharts": "2.15.3", "sonner": "^2.0.8", @@ -62,8 +61,8 @@ "@types/ini": "^4.1.1", "@types/node": "22.12.0", "@types/papaparse": "^5.5.2", - "@types/react": "18.2.22", - "@types/react-dom": "^18", + "@types/react": "19.3.0", + "@types/react-dom": "^19.3.0", "@typescript-eslint/eslint-plugin": "^8.72.2", "@typescript-eslint/parser": "^8.35.1", "@vitejs/plugin-react": "^5.0.0", @@ -4929,33 +4928,24 @@ "@types/node": "*" } }, - "node_modules/@types/prop-types": { - "version": "15.7.15", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", - "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", - "devOptional": true, - "license": "MIT" - }, "node_modules/@types/react": { - "version": "18.2.22", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.22.tgz", - "integrity": "sha512-60fLTOLqzarLED2O3UQImc/lsNRgG0jE/a1mPW9KjMemY0LMITWEsbS4VvZ4p6rorEHd5YKxxmMKSDK505GHpA==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", "devOptional": true, "license": "MIT", "dependencies": { - "@types/prop-types": "*", - "@types/scheduler": "*", - "csstype": "^3.0.2" + "csstype": "^3.2.2" } }, "node_modules/@types/react-dom": { - "version": "18.3.7", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", - "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", "devOptional": true, "license": "MIT", "peerDependencies": { - "@types/react": "^18.0.0" + "@types/react": "^19.3.0" } }, "node_modules/@types/readdir-glob": { @@ -4967,13 +4957,6 @@ "@types/node": "*" } }, - "node_modules/@types/scheduler": { - "version": "0.26.0", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.26.0.tgz", - "integrity": "sha512-WFHp9YUJQ6CKshqoC37iOlHnQSmxNc795UhB26CyBBttrN9svdIrUjl/NjnNmfcwtncN0h/0PPAFWv9ovP8mLA==", - "devOptional": true, - "license": "MIT" - }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.72.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.2.tgz", @@ -7139,9 +7122,9 @@ } }, "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", "license": "MIT" }, "node_modules/d3-color": { @@ -8616,9 +8599,9 @@ "license": "Apache-2.0" }, "node_modules/fast-equals": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.2.2.tgz", - "integrity": "sha512-V7/RktU11J3I36Nwq2JnZEM7tNm17eBJz+u25qdxBZeCKiX6BkVSZQjwWIr+IobgnZy+ag73tTZgZi7tr0LrBw==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.4.5.tgz", + "integrity": "sha512-yKEpcFuRPu/pTQL2VB8YKE2yFldrLlIsoWtJeBnAdqEhvu21OgkFT0C8njf/xYc2LSZGEr3K9JGjthHJxnVLvQ==", "license": "MIT", "engines": { "node": ">=6.0.0" @@ -11810,42 +11793,24 @@ } }, "node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - }, "engines": { "node": ">=0.10.0" } }, - "node_modules/react-day-picker": { - "version": "8.10.1", - "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-8.10.1.tgz", - "integrity": "sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==", - "license": "MIT", - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/gpbl" - }, - "peerDependencies": { - "date-fns": "^2.28.0 || ^3.0.0", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/react-dom": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", - "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.2" + "scheduler": "^0.28.0" }, "peerDependencies": { - "react": "^18.3.1" + "react": "^19.3.1" } }, "node_modules/react-is": { @@ -12425,13 +12390,10 @@ } }, "node_modules/scheduler": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", - "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - } + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "license": "MIT" }, "node_modules/schema-utils": { "version": "4.8.3", diff --git a/package.json b/package.json index db090f560..23ac82a8f 100644 --- a/package.json +++ b/package.json @@ -98,8 +98,8 @@ "@types/ini": "^4.1.1", "@types/node": "22.12.0", "@types/papaparse": "^5.5.2", - "@types/react": "18.2.22", - "@types/react-dom": "^18", + "@types/react": "19.3.0", + "@types/react-dom": "^19.3.0", "@typescript-eslint/eslint-plugin": "^8.72.2", "@typescript-eslint/parser": "^8.35.1", "@vitejs/plugin-react": "^5.0.0", @@ -150,9 +150,8 @@ "next": "^15.5.29", "next-themes": "0.4.6", "radix-ui": "^1.8.1", - "react": "^18.3.1", - "react-day-picker": "8.10.1", - "react-dom": "^18.3.1", + "react": "^19.3.1", + "react-dom": "^19.3.1", "react-virtuoso": "^4.18.22", "recharts": "2.15.3", "sonner": "^2.0.8", diff --git a/scripts/.dead-modules-baseline.json b/scripts/.dead-modules-baseline.json index 47d9a79cc..328cf79d5 100644 --- a/scripts/.dead-modules-baseline.json +++ b/scripts/.dead-modules-baseline.json @@ -84,7 +84,6 @@ "components/virtualized-game-grid.tsx": "88 righe", "hooks/useHowLongToBeat.ts": "84 righe", "app/utils/steam-local-files.ts": "81 righe", - "components/ui/calendar.tsx": "71 righe", "components/ui/toggle.tsx": "50 righe", "components/ui/theme-toggle.tsx": "36 righe", "components/theme-toggle.tsx": "32 righe",