cogsbox-state 0.5.378 → 0.5.379
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 +236 -237
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +19 -12
package/package.json
CHANGED
package/src/CogsState.tsx
CHANGED
|
@@ -1958,18 +1958,25 @@ function createProxyHandler<T>(
|
|
|
1958
1958
|
const smallAddition = addedItems > 0 && addedItems <= 3;
|
|
1959
1959
|
|
|
1960
1960
|
if (smallAddition) {
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1961
|
+
// Let DOM render before measuring + scrolling
|
|
1962
|
+
requestAnimationFrame(() => {
|
|
1963
|
+
const prevBottom =
|
|
1964
|
+
positions[prevCount] ?? container.scrollHeight;
|
|
1965
|
+
const newBottom = container.scrollHeight;
|
|
1966
|
+
const delta = newBottom - prevBottom;
|
|
1967
|
+
|
|
1968
|
+
if (delta > 0) {
|
|
1969
|
+
container.scrollBy({
|
|
1970
|
+
top: delta,
|
|
1971
|
+
behavior: "smooth",
|
|
1972
|
+
});
|
|
1973
|
+
}
|
|
1968
1974
|
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1975
|
+
console.log(
|
|
1976
|
+
"ACTION (GETTING_HEIGHTS): Small addition -> LOCKED_AT_BOTTOM"
|
|
1977
|
+
);
|
|
1978
|
+
setStatus("LOCKED_AT_BOTTOM");
|
|
1979
|
+
});
|
|
1973
1980
|
} else {
|
|
1974
1981
|
console.log(
|
|
1975
1982
|
"ACTION (GETTING_HEIGHTS): Large change -> SCROLLING_TO_BOTTOM"
|
|
@@ -1978,7 +1985,7 @@ function createProxyHandler<T>(
|
|
|
1978
1985
|
}
|
|
1979
1986
|
}
|
|
1980
1987
|
}
|
|
1981
|
-
},
|
|
1988
|
+
}, 50);
|
|
1982
1989
|
|
|
1983
1990
|
return () => clearInterval(intervalId);
|
|
1984
1991
|
} else if (status === "SCROLLING_TO_BOTTOM") {
|