@trackunit/react-components 1.9.47 → 1.9.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +10 -3
- package/index.esm.js +10 -3
- package/package.json +6 -6
package/index.cjs.js
CHANGED
|
@@ -3792,10 +3792,17 @@ const useList = ({ count, pagination, header, getItem, loadingIndicator = DEFAUL
|
|
|
3792
3792
|
// eslint-disable-next-line react-hooks/react-compiler
|
|
3793
3793
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3794
3794
|
}, []);
|
|
3795
|
-
// Scroll to top when
|
|
3795
|
+
// Scroll to top when total count changes (filtering applied)
|
|
3796
|
+
// Don't scroll when just loading more items (infinite scroll - total stays the same)
|
|
3797
|
+
const previousCountRef = react.useRef(pagination?.pageInfo?.count ?? 0);
|
|
3796
3798
|
react.useLayoutEffect(() => {
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
+
const currentCount = pagination?.pageInfo?.count ?? 0;
|
|
3800
|
+
const totalCountChanged = currentCount !== previousCountRef.current;
|
|
3801
|
+
if (totalCountChanged) {
|
|
3802
|
+
virtualizer.scrollToOffset(0);
|
|
3803
|
+
}
|
|
3804
|
+
previousCountRef.current = currentCount;
|
|
3805
|
+
}, [virtualizer, pagination?.pageInfo?.count]);
|
|
3799
3806
|
// Transform virtual items into typed rows
|
|
3800
3807
|
const rows = react.useMemo(() => {
|
|
3801
3808
|
const virtualItems = virtualizer.getVirtualItems();
|
package/index.esm.js
CHANGED
|
@@ -3790,10 +3790,17 @@ const useList = ({ count, pagination, header, getItem, loadingIndicator = DEFAUL
|
|
|
3790
3790
|
// eslint-disable-next-line react-hooks/react-compiler
|
|
3791
3791
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3792
3792
|
}, []);
|
|
3793
|
-
// Scroll to top when
|
|
3793
|
+
// Scroll to top when total count changes (filtering applied)
|
|
3794
|
+
// Don't scroll when just loading more items (infinite scroll - total stays the same)
|
|
3795
|
+
const previousCountRef = useRef(pagination?.pageInfo?.count ?? 0);
|
|
3794
3796
|
useLayoutEffect(() => {
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
+
const currentCount = pagination?.pageInfo?.count ?? 0;
|
|
3798
|
+
const totalCountChanged = currentCount !== previousCountRef.current;
|
|
3799
|
+
if (totalCountChanged) {
|
|
3800
|
+
virtualizer.scrollToOffset(0);
|
|
3801
|
+
}
|
|
3802
|
+
previousCountRef.current = currentCount;
|
|
3803
|
+
}, [virtualizer, pagination?.pageInfo?.count]);
|
|
3797
3804
|
// Transform virtual items into typed rows
|
|
3798
3805
|
const rows = useMemo(() => {
|
|
3799
3806
|
const virtualItems = virtualizer.getVirtualItems();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.50",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"@floating-ui/react": "^0.26.25",
|
|
17
17
|
"string-ts": "^2.0.0",
|
|
18
18
|
"tailwind-merge": "^2.0.0",
|
|
19
|
-
"@trackunit/ui-design-tokens": "1.7.
|
|
20
|
-
"@trackunit/css-class-variance-utilities": "1.7.
|
|
21
|
-
"@trackunit/shared-utils": "1.9.
|
|
22
|
-
"@trackunit/ui-icons": "1.7.
|
|
23
|
-
"@trackunit/react-test-setup": "1.4.
|
|
19
|
+
"@trackunit/ui-design-tokens": "1.7.35",
|
|
20
|
+
"@trackunit/css-class-variance-utilities": "1.7.34",
|
|
21
|
+
"@trackunit/shared-utils": "1.9.34",
|
|
22
|
+
"@trackunit/ui-icons": "1.7.36",
|
|
23
|
+
"@trackunit/react-test-setup": "1.4.34",
|
|
24
24
|
"@tanstack/react-router": "1.114.29",
|
|
25
25
|
"es-toolkit": "^1.39.10",
|
|
26
26
|
"@tanstack/react-virtual": "3.13.12"
|