cogsbox-state 0.5.354 → 0.5.355
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 +536 -532
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +10 -3
package/package.json
CHANGED
package/src/CogsState.tsx
CHANGED
|
@@ -1816,7 +1816,7 @@ function createProxyHandler<T>(
|
|
|
1816
1816
|
});
|
|
1817
1817
|
|
|
1818
1818
|
const isLockedToBottomRef = useRef(stickToBottom);
|
|
1819
|
-
|
|
1819
|
+
const isAutoScrolling = useRef(false);
|
|
1820
1820
|
const [shadowUpdateTrigger, setShadowUpdateTrigger] = useState(0);
|
|
1821
1821
|
|
|
1822
1822
|
useEffect(() => {
|
|
@@ -1915,12 +1915,15 @@ function createProxyHandler<T>(
|
|
|
1915
1915
|
"color: green; font-weight: bold;"
|
|
1916
1916
|
);
|
|
1917
1917
|
clearInterval(intervalId); // Stop the loop.
|
|
1918
|
-
|
|
1918
|
+
isAutoScrolling.current = true;
|
|
1919
1919
|
// STEP 3: Scroll.
|
|
1920
1920
|
container.scrollTo({
|
|
1921
1921
|
top: container.scrollHeight,
|
|
1922
1922
|
behavior: "smooth",
|
|
1923
1923
|
});
|
|
1924
|
+
setTimeout(() => {
|
|
1925
|
+
isAutoScrolling.current = false;
|
|
1926
|
+
}, 1000);
|
|
1924
1927
|
} else {
|
|
1925
1928
|
console.log("...WAITING. Height is not ready.");
|
|
1926
1929
|
if (loopCount > 20) {
|
|
@@ -1938,7 +1941,7 @@ function createProxyHandler<T>(
|
|
|
1938
1941
|
console.log("ALGORITHM: Cleaning up loop.");
|
|
1939
1942
|
clearInterval(intervalId);
|
|
1940
1943
|
};
|
|
1941
|
-
}, [totalCount, ...(options.dependencies ?? [])]); // This whole process triggers ONLY when totalCount changes.
|
|
1944
|
+
}, [totalCount, totalHeight, ...(options.dependencies ?? [])]); // This whole process triggers ONLY when totalCount changes.
|
|
1942
1945
|
|
|
1943
1946
|
// Effect to handle user scrolling.
|
|
1944
1947
|
useEffect(() => {
|
|
@@ -1970,6 +1973,10 @@ function createProxyHandler<T>(
|
|
|
1970
1973
|
};
|
|
1971
1974
|
|
|
1972
1975
|
const handleUserScroll = () => {
|
|
1976
|
+
if (isAutoScrolling.current) {
|
|
1977
|
+
// <--- ADD THIS CHECK
|
|
1978
|
+
return;
|
|
1979
|
+
}
|
|
1973
1980
|
const isAtBottom =
|
|
1974
1981
|
container.scrollHeight -
|
|
1975
1982
|
container.scrollTop -
|