cogsbox-state 0.5.317 → 0.5.318
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 +529 -534
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +12 -15
package/package.json
CHANGED
package/src/CogsState.tsx
CHANGED
|
@@ -1966,29 +1966,32 @@ function createProxyHandler<T>(
|
|
|
1966
1966
|
passive: true,
|
|
1967
1967
|
});
|
|
1968
1968
|
|
|
1969
|
-
// For stick to bottom:
|
|
1969
|
+
// For stick to bottom: check conditions without triggering re-renders
|
|
1970
1970
|
if (
|
|
1971
1971
|
stickToBottom &&
|
|
1972
1972
|
!hasScrolledToBottomRef.current &&
|
|
1973
1973
|
totalCount > 0
|
|
1974
1974
|
) {
|
|
1975
|
-
|
|
1976
|
-
|
|
1975
|
+
// Check current range without dependency
|
|
1976
|
+
const currentRange = range;
|
|
1977
|
+
const atEnd = currentRange.endIndex >= totalCount - 5; // Close to end
|
|
1978
|
+
|
|
1979
|
+
if (atEnd) {
|
|
1977
1980
|
console.log(
|
|
1978
|
-
`[VirtualView]
|
|
1981
|
+
`[VirtualView] At end of list, scrolling to bottom`
|
|
1979
1982
|
);
|
|
1980
1983
|
hasScrolledToBottomRef.current = true;
|
|
1981
1984
|
|
|
1982
|
-
// Use setTimeout to ensure DOM updates are complete
|
|
1983
1985
|
setTimeout(() => {
|
|
1986
|
+
const scrollTarget = container.scrollHeight + 1000;
|
|
1984
1987
|
container.scrollTo({
|
|
1985
|
-
top:
|
|
1988
|
+
top: scrollTarget,
|
|
1986
1989
|
behavior: "auto",
|
|
1987
1990
|
});
|
|
1988
1991
|
isLockedToBottomRef.current = true;
|
|
1989
|
-
},
|
|
1992
|
+
}, 50);
|
|
1990
1993
|
} else {
|
|
1991
|
-
// Jump close to the bottom
|
|
1994
|
+
// Jump close to the bottom
|
|
1992
1995
|
console.log(
|
|
1993
1996
|
`[VirtualView] Jumping near bottom to trigger measurements`
|
|
1994
1997
|
);
|
|
@@ -2008,13 +2011,7 @@ function createProxyHandler<T>(
|
|
|
2008
2011
|
return () => {
|
|
2009
2012
|
container.removeEventListener("scroll", handleUserScroll);
|
|
2010
2013
|
};
|
|
2011
|
-
}, [
|
|
2012
|
-
totalCount,
|
|
2013
|
-
positions,
|
|
2014
|
-
stickToBottom,
|
|
2015
|
-
visibleMeasured,
|
|
2016
|
-
range.endIndex,
|
|
2017
|
-
]);
|
|
2014
|
+
}, [totalCount, positions, stickToBottom]); // Removed visibleMeasured and range.endIndex
|
|
2018
2015
|
|
|
2019
2016
|
const scrollToBottom = useCallback(
|
|
2020
2017
|
(behavior: ScrollBehavior = "smooth") => {
|