From 94afa9bdcb8e476f00d4c87b4d1b83c2f2d0d731 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 20:33:44 +0000 Subject: [PATCH 1/5] Initial plan From f88ea36dbe560d6d7d03fa2a944f868bd7a8fcc4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 20:37:54 +0000 Subject: [PATCH 2/5] Fix React 17 compatibility by using 'in' operator to check for useInsertionEffect Co-authored-by: thebuilder <3764345+thebuilder@users.noreply.github.com> --- src/useOnInView.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/useOnInView.tsx b/src/useOnInView.tsx index 25440f3d..1e8ee843 100644 --- a/src/useOnInView.tsx +++ b/src/useOnInView.tsx @@ -6,11 +6,10 @@ import type { import { observe } from "./observe"; const useSyncEffect = - ( - React as typeof React & { - useInsertionEffect?: typeof React.useEffect; - } - ).useInsertionEffect ?? + ("useInsertionEffect" in React + ? // @ts-ignore useInsertionEffect is only available in React 18+ + React.useInsertionEffect + : null) ?? React.useLayoutEffect ?? React.useEffect; From 99b5cba5a7c1e38f77df25ffcd9ccd9927360381 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 22:15:37 +0000 Subject: [PATCH 3/5] Fix TypeScript error by using undefined instead of null in ternary Co-authored-by: thebuilder <3764345+thebuilder@users.noreply.github.com> --- src/useOnInView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/useOnInView.tsx b/src/useOnInView.tsx index 1e8ee843..1c2e8dfc 100644 --- a/src/useOnInView.tsx +++ b/src/useOnInView.tsx @@ -9,7 +9,7 @@ const useSyncEffect = ("useInsertionEffect" in React ? // @ts-ignore useInsertionEffect is only available in React 18+ React.useInsertionEffect - : null) ?? + : undefined) ?? React.useLayoutEffect ?? React.useEffect; From 043ac66c0e15de07d39eb291915e2dd6b7569d01 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 11:05:25 +0000 Subject: [PATCH 4/5] Fix React 17 TypeScript compilation by using proper type assertion Co-authored-by: thebuilder <3764345+thebuilder@users.noreply.github.com> --- package.json | 4 ++-- pnpm-lock.yaml | 45 +++++++++++++++++++++++++++++++++++++-------- src/useOnInView.tsx | 11 +++++------ 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index e851acaa..47344a7b 100644 --- a/package.json +++ b/package.json @@ -126,8 +126,8 @@ "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.1", "@types/node": "^25.0.3", - "@types/react": "^19.2.7", - "@types/react-dom": "^19.2.3", + "@types/react": "^17.0.90", + "@types/react-dom": "^17.0.26", "@vitejs/plugin-react": "^5.1.2", "@vitest/browser-playwright": "^4.0.16", "@vitest/coverage-istanbul": "^4.0.16", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index beb641e1..7a6cdea2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,16 +22,16 @@ importers: version: 6.9.1 '@testing-library/react': specifier: ^16.3.1 - version: 16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.3(react@19.2.3))(react@19.2.3) + version: 16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@17.0.26(@types/react@17.0.90))(@types/react@17.0.90)(react-dom@19.2.3(react@19.2.3))(react@19.2.3) '@types/node': specifier: ^25.0.3 version: 25.0.3 '@types/react': - specifier: ^19.2.7 - version: 19.2.7 + specifier: ^17.0.90 + version: 17.0.90 '@types/react-dom': - specifier: ^19.2.3 - version: 19.2.3(@types/react@19.2.7) + specifier: ^17.0.26 + version: 17.0.26(@types/react@17.0.90) '@vitejs/plugin-react': specifier: ^5.1.2 version: 5.1.2(vite@7.3.0(@types/node@25.0.3)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.37.0)(yaml@2.8.2)) @@ -1727,11 +1727,22 @@ packages: '@types/parse-json@4.0.0': resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} + '@types/prop-types@15.7.15': + resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==} + + '@types/react-dom@17.0.26': + resolution: {integrity: sha512-Z+2VcYXJwOqQ79HreLU/1fyQ88eXSSFh6I3JdrEHQIfYSI0kCQpTGvOrbE6jFGGYXKsHuwY9tBa/w5Uo6KzrEg==} + peerDependencies: + '@types/react': ^17.0.0 + '@types/react-dom@19.2.3': resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==} peerDependencies: '@types/react': ^19.2.0 + '@types/react@17.0.90': + resolution: {integrity: sha512-P9beVR/x06U9rCJzSxtENnOr4BrbJ6VrsrDTc+73TtHv9XHhryXKbjGRB+6oooB2r0G/pQkD/S4dHo/7jUfwFw==} + '@types/react@19.2.7': resolution: {integrity: sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==} @@ -1741,6 +1752,9 @@ packages: '@types/resolve@1.20.6': resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} + '@types/scheduler@0.16.8': + resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} + '@types/statuses@2.0.6': resolution: {integrity: sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==} @@ -4514,6 +4528,7 @@ packages: whatwg-encoding@3.1.1: resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} engines: {node: '>=18'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation whatwg-mimetype@4.0.0: resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} @@ -6248,15 +6263,15 @@ snapshots: picocolors: 1.1.1 redent: 3.0.0 - '@testing-library/react@16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': + '@testing-library/react@16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@17.0.26(@types/react@17.0.90))(@types/react@17.0.90)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': dependencies: '@babel/runtime': 7.28.4 '@testing-library/dom': 10.4.1 react: 19.2.3 react-dom: 19.2.3(react@19.2.3) optionalDependencies: - '@types/react': 19.2.7 - '@types/react-dom': 19.2.3(@types/react@19.2.7) + '@types/react': 17.0.90 + '@types/react-dom': 17.0.26(@types/react@17.0.90) '@testing-library/user-event@14.6.1(@testing-library/dom@10.4.1)': dependencies: @@ -6311,10 +6326,22 @@ snapshots: '@types/parse-json@4.0.0': {} + '@types/prop-types@15.7.15': {} + + '@types/react-dom@17.0.26(@types/react@17.0.90)': + dependencies: + '@types/react': 17.0.90 + '@types/react-dom@19.2.3(@types/react@19.2.7)': dependencies: '@types/react': 19.2.7 + '@types/react@17.0.90': + dependencies: + '@types/prop-types': 15.7.15 + '@types/scheduler': 0.16.8 + csstype: 3.2.3 + '@types/react@19.2.7': dependencies: csstype: 3.2.3 @@ -6325,6 +6352,8 @@ snapshots: '@types/resolve@1.20.6': {} + '@types/scheduler@0.16.8': {} + '@types/statuses@2.0.6': optional: true diff --git a/src/useOnInView.tsx b/src/useOnInView.tsx index 1c2e8dfc..229a6769 100644 --- a/src/useOnInView.tsx +++ b/src/useOnInView.tsx @@ -5,13 +5,12 @@ import type { } from "./index"; import { observe } from "./observe"; -const useSyncEffect = - ("useInsertionEffect" in React - ? // @ts-ignore useInsertionEffect is only available in React 18+ - React.useInsertionEffect - : undefined) ?? +const useSyncEffect = (("useInsertionEffect" in React + ? (React as typeof React & { useInsertionEffect: typeof React.useEffect }) + .useInsertionEffect + : undefined) ?? React.useLayoutEffect ?? - React.useEffect; + React.useEffect) as typeof React.useEffect; /** * React Hooks make it easy to monitor when elements come into and leave view. Call From 481480ee2de2d796719e5a5d3f33fd12955de7e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 11:06:11 +0000 Subject: [PATCH 5/5] Co-authored-by: thebuilder <3764345+thebuilder@users.noreply.github.com> --- package.json | 4 ++-- pnpm-lock.yaml | 44 ++++++++------------------------------------ 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 47344a7b..e851acaa 100644 --- a/package.json +++ b/package.json @@ -126,8 +126,8 @@ "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.1", "@types/node": "^25.0.3", - "@types/react": "^17.0.90", - "@types/react-dom": "^17.0.26", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^5.1.2", "@vitest/browser-playwright": "^4.0.16", "@vitest/coverage-istanbul": "^4.0.16", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a6cdea2..f277a993 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,16 +22,16 @@ importers: version: 6.9.1 '@testing-library/react': specifier: ^16.3.1 - version: 16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@17.0.26(@types/react@17.0.90))(@types/react@17.0.90)(react-dom@19.2.3(react@19.2.3))(react@19.2.3) + version: 16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.3(react@19.2.3))(react@19.2.3) '@types/node': specifier: ^25.0.3 version: 25.0.3 '@types/react': - specifier: ^17.0.90 - version: 17.0.90 + specifier: ^19.2.7 + version: 19.2.7 '@types/react-dom': - specifier: ^17.0.26 - version: 17.0.26(@types/react@17.0.90) + specifier: ^19.2.3 + version: 19.2.3(@types/react@19.2.7) '@vitejs/plugin-react': specifier: ^5.1.2 version: 5.1.2(vite@7.3.0(@types/node@25.0.3)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.37.0)(yaml@2.8.2)) @@ -1727,22 +1727,11 @@ packages: '@types/parse-json@4.0.0': resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} - '@types/prop-types@15.7.15': - resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==} - - '@types/react-dom@17.0.26': - resolution: {integrity: sha512-Z+2VcYXJwOqQ79HreLU/1fyQ88eXSSFh6I3JdrEHQIfYSI0kCQpTGvOrbE6jFGGYXKsHuwY9tBa/w5Uo6KzrEg==} - peerDependencies: - '@types/react': ^17.0.0 - '@types/react-dom@19.2.3': resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==} peerDependencies: '@types/react': ^19.2.0 - '@types/react@17.0.90': - resolution: {integrity: sha512-P9beVR/x06U9rCJzSxtENnOr4BrbJ6VrsrDTc+73TtHv9XHhryXKbjGRB+6oooB2r0G/pQkD/S4dHo/7jUfwFw==} - '@types/react@19.2.7': resolution: {integrity: sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==} @@ -1752,9 +1741,6 @@ packages: '@types/resolve@1.20.6': resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} - '@types/scheduler@0.16.8': - resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} - '@types/statuses@2.0.6': resolution: {integrity: sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==} @@ -6263,15 +6249,15 @@ snapshots: picocolors: 1.1.1 redent: 3.0.0 - '@testing-library/react@16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@17.0.26(@types/react@17.0.90))(@types/react@17.0.90)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': + '@testing-library/react@16.3.1(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': dependencies: '@babel/runtime': 7.28.4 '@testing-library/dom': 10.4.1 react: 19.2.3 react-dom: 19.2.3(react@19.2.3) optionalDependencies: - '@types/react': 17.0.90 - '@types/react-dom': 17.0.26(@types/react@17.0.90) + '@types/react': 19.2.7 + '@types/react-dom': 19.2.3(@types/react@19.2.7) '@testing-library/user-event@14.6.1(@testing-library/dom@10.4.1)': dependencies: @@ -6326,22 +6312,10 @@ snapshots: '@types/parse-json@4.0.0': {} - '@types/prop-types@15.7.15': {} - - '@types/react-dom@17.0.26(@types/react@17.0.90)': - dependencies: - '@types/react': 17.0.90 - '@types/react-dom@19.2.3(@types/react@19.2.7)': dependencies: '@types/react': 19.2.7 - '@types/react@17.0.90': - dependencies: - '@types/prop-types': 15.7.15 - '@types/scheduler': 0.16.8 - csstype: 3.2.3 - '@types/react@19.2.7': dependencies: csstype: 3.2.3 @@ -6352,8 +6326,6 @@ snapshots: '@types/resolve@1.20.6': {} - '@types/scheduler@0.16.8': {} - '@types/statuses@2.0.6': optional: true