cogsbox-state 0.5.365 → 0.5.366
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 +77 -79
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +11 -6
package/package.json
CHANGED
package/src/CogsState.tsx
CHANGED
|
@@ -1916,6 +1916,7 @@ function createProxyHandler<T>(
|
|
|
1916
1916
|
if (!container) return;
|
|
1917
1917
|
|
|
1918
1918
|
let intervalId: NodeJS.Timeout | undefined;
|
|
1919
|
+
let scrollTimeoutId: NodeJS.Timeout | undefined;
|
|
1919
1920
|
|
|
1920
1921
|
if (
|
|
1921
1922
|
status === "WAITING_FOR_ARRAY" &&
|
|
@@ -1962,9 +1963,7 @@ function createProxyHandler<T>(
|
|
|
1962
1963
|
behavior: scrollBehavior,
|
|
1963
1964
|
});
|
|
1964
1965
|
|
|
1965
|
-
|
|
1966
|
-
// Use a timeout to wait for the animation to finish.
|
|
1967
|
-
const timeoutId = setTimeout(
|
|
1966
|
+
scrollTimeoutId = setTimeout(
|
|
1968
1967
|
() => {
|
|
1969
1968
|
console.log(
|
|
1970
1969
|
"ACTION: Scroll finished. -> LOCKED_AT_BOTTOM"
|
|
@@ -1973,12 +1972,18 @@ function createProxyHandler<T>(
|
|
|
1973
1972
|
},
|
|
1974
1973
|
scrollBehavior === "smooth" ? 500 : 50
|
|
1975
1974
|
);
|
|
1976
|
-
|
|
1977
|
-
return () => clearTimeout(timeoutId);
|
|
1978
1975
|
}
|
|
1979
1976
|
|
|
1977
|
+
// THE FIX: This cleanup runs whenever the state changes, killing any active timers.
|
|
1980
1978
|
return () => {
|
|
1981
|
-
if (intervalId)
|
|
1979
|
+
if (intervalId) {
|
|
1980
|
+
console.log("CLEANUP: Clearing measurement loop timer.");
|
|
1981
|
+
clearInterval(intervalId);
|
|
1982
|
+
}
|
|
1983
|
+
if (scrollTimeoutId) {
|
|
1984
|
+
console.log("CLEANUP: Clearing scroll-end timer.");
|
|
1985
|
+
clearTimeout(scrollTimeoutId);
|
|
1986
|
+
}
|
|
1982
1987
|
};
|
|
1983
1988
|
}, [status, totalCount, positions]);
|
|
1984
1989
|
|