Skip to content

Commit 2ad3828

Browse files
committed
React v19 compatibility
1 parent 4ddf7eb commit 2ad3828

File tree

10 files changed

+1185
-739
lines changed

10 files changed

+1185
-739
lines changed

apps/demo/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

apps/demo/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
"typecheck": "tsc"
1212
},
1313
"dependencies": {
14-
"next": "14.2.5",
15-
"react": "^18.3.1",
16-
"react-dom": "^18.3.1",
14+
"next": "15.3.1",
15+
"react": "^19.1.0",
16+
"react-dom": "^19.1.0",
1717
"react-infinite-scroll-hook": "*"
1818
},
1919
"devDependencies": {
2020
"@repo/eslint-config": "*",
2121
"@repo/lint-staged-config": "*",
2222
"@repo/typescript-config": "*",
23-
"@types/node": "^22.4.0",
24-
"@types/react": "^18.3.3",
25-
"@types/react-dom": "^18.3.0",
26-
"autoprefixer": "^10.4.20",
23+
"@types/node": "^22.15.3",
24+
"@types/react": "^19.1.2",
25+
"@types/react-dom": "^19.1.3",
26+
"autoprefixer": "^10.4.21",
2727
"eslint": "^8.57.0",
2828
"eslint-config-next": "14.2.5",
29-
"postcss": "^8.4.41",
29+
"postcss": "^8.5.3",
3030
"tailwindcss": "^3.4.10",
31-
"typescript": "^5.5.4"
31+
"typescript": "^5.8.3"
3232
}
3333
}

apps/demo/src/app/reverse-horizontal-element-scroll/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ export default function ReverseHorizontalElementScrollPage() {
1717
});
1818

1919
const scrollableRootRef = useRef<React.ComponentRef<'div'> | null>(null);
20-
const lastScrollDistanceToRightRef = useRef<number>();
20+
const lastScrollDistanceToRightRef = useRef<number>(0);
2121

2222
const reversedItems = useMemo(() => [...items].reverse(), [items]);
2323

2424
// We keep the scroll position when new items are added etc.
2525
useLayoutEffect(() => {
2626
const scrollableRoot = scrollableRootRef.current;
27-
const lastScrollDistanceToRight = lastScrollDistanceToRightRef.current ?? 0;
27+
const lastScrollDistanceToRight = lastScrollDistanceToRightRef.current;
2828
if (scrollableRoot) {
2929
scrollableRoot.scrollLeft =
3030
scrollableRoot.scrollWidth - lastScrollDistanceToRight;

apps/demo/src/app/reverse-vertical-element-scroll/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ export default function ReverseVerticalElementScrollPage() {
1717
});
1818

1919
const scrollableRootRef = useRef<React.ComponentRef<'div'> | null>(null);
20-
const lastScrollDistanceToBottomRef = useRef<number>();
20+
const lastScrollDistanceToBottomRef = useRef<number>(0);
2121

2222
const reversedItems = useMemo(() => [...items].reverse(), [items]);
2323

2424
// We keep the scroll position when new items are added etc.
2525
useLayoutEffect(() => {
2626
const scrollableRoot = scrollableRootRef.current;
27-
const lastScrollDistanceToBottom =
28-
lastScrollDistanceToBottomRef.current ?? 0;
27+
const lastScrollDistanceToBottom = lastScrollDistanceToBottomRef.current;
2928
if (scrollableRoot) {
3029
scrollableRoot.scrollTop =
3130
scrollableRoot.scrollHeight - lastScrollDistanceToBottom;

apps/demo/src/app/reverse-window-scroll/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ export default function ReverseWindowScrollPage() {
1616
disabled: Boolean(error),
1717
});
1818

19-
const lastScrollDistanceToBottomRef = useRef<number>();
19+
const lastScrollDistanceToBottomRef = useRef<number>(0);
2020

2121
const reversedItems = useMemo(() => [...items].reverse(), [items]);
2222

2323
// We keep the scroll position when new items are added etc.
2424
useLayoutEffect(() => {
25-
const lastScrollDistanceToBottom =
26-
lastScrollDistanceToBottomRef.current ?? 0;
25+
const lastScrollDistanceToBottom = lastScrollDistanceToBottomRef.current;
2726

2827
document.documentElement.scrollTop =
2928
document.body.scrollHeight - lastScrollDistanceToBottom;

0 commit comments

Comments
 (0)