cogsbox-state 0.5.338 → 0.5.339
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/dist/CogsState.jsx +181 -196
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +24 -24
package/package.json
CHANGED
package/src/CogsState.tsx
CHANGED
|
@@ -1871,29 +1871,29 @@ function createProxyHandler<T>(
|
|
|
1871
1871
|
validIndices,
|
|
1872
1872
|
});
|
|
1873
1873
|
}, [range.startIndex, range.endIndex, sourceArray, totalCount]);
|
|
1874
|
-
useEffect(() => {
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
}, [totalCount]);
|
|
1874
|
+
// useEffect(() => {
|
|
1875
|
+
// if (stickToBottom && totalCount > 0 && containerRef.current) {
|
|
1876
|
+
// // When count increases, immediately adjust range to show bottom
|
|
1877
|
+
// const container = containerRef.current;
|
|
1878
|
+
// const visibleCount = Math.ceil(
|
|
1879
|
+
// container.clientHeight / itemHeight
|
|
1880
|
+
// );
|
|
1881
|
+
|
|
1882
|
+
// // Set range to show the last items including the new one
|
|
1883
|
+
// setRange({
|
|
1884
|
+
// startIndex: Math.max(
|
|
1885
|
+
// 0,
|
|
1886
|
+
// totalCount - visibleCount - overscan
|
|
1887
|
+
// ),
|
|
1888
|
+
// endIndex: totalCount,
|
|
1889
|
+
// });
|
|
1890
|
+
|
|
1891
|
+
// // Then scroll to bottom after a short delay
|
|
1892
|
+
// setTimeout(() => {
|
|
1893
|
+
// container.scrollTop = container.scrollHeight + 9999;
|
|
1894
|
+
// }, 200);
|
|
1895
|
+
// }
|
|
1896
|
+
// }, [totalCount]);
|
|
1897
1897
|
// This is the main effect that handles all scrolling and updates.
|
|
1898
1898
|
useLayoutEffect(() => {
|
|
1899
1899
|
const container = containerRef.current;
|
|
@@ -1905,7 +1905,7 @@ function createProxyHandler<T>(
|
|
|
1905
1905
|
container.scrollHeight -
|
|
1906
1906
|
container.scrollTop -
|
|
1907
1907
|
container.clientHeight <
|
|
1908
|
-
|
|
1908
|
+
itemHeight;
|
|
1909
1909
|
|
|
1910
1910
|
// This function determines what's visible in the viewport.
|
|
1911
1911
|
const updateVirtualRange = () => {
|