cogsbox-state 0.5.379 → 0.5.381

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cogsbox-state",
3
- "version": "0.5.379",
3
+ "version": "0.5.381",
4
4
  "description": "React state management library with form controls and server sync",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/CogsState.tsx CHANGED
@@ -1933,13 +1933,11 @@ function createProxyHandler<T>(
1933
1933
  console.log(
1934
1934
  "ACTION (GETTING_HEIGHTS): Setting range to end and starting loop."
1935
1935
  );
1936
-
1937
1936
  setRange({
1938
1937
  startIndex: Math.max(0, totalCount - 10 - overscan),
1939
1938
  endIndex: totalCount,
1940
1939
  });
1941
1940
 
1942
- let intervalId: NodeJS.Timeout;
1943
1941
  intervalId = setInterval(() => {
1944
1942
  const lastItemIndex = totalCount - 1;
1945
1943
  const shadowArray =
@@ -1951,43 +1949,15 @@ function createProxyHandler<T>(
1951
1949
 
1952
1950
  if (lastItemHeight > 0) {
1953
1951
  clearInterval(intervalId);
1954
-
1955
1952
  if (!shouldNotScroll.current) {
1956
- const prevCount = prevTotalCountRef.current;
1957
- const addedItems = totalCount - prevCount;
1958
- const smallAddition = addedItems > 0 && addedItems <= 3;
1959
-
1960
- if (smallAddition) {
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
- }
1953
+ console.log(
1954
+ "ACTION (GETTING_HEIGHTS): Measurement success -> SCROLLING_TO_BOTTOM"
1955
+ );
1974
1956
 
1975
- console.log(
1976
- "ACTION (GETTING_HEIGHTS): Small addition -> LOCKED_AT_BOTTOM"
1977
- );
1978
- setStatus("LOCKED_AT_BOTTOM");
1979
- });
1980
- } else {
1981
- console.log(
1982
- "ACTION (GETTING_HEIGHTS): Large change -> SCROLLING_TO_BOTTOM"
1983
- );
1984
- setStatus("SCROLLING_TO_BOTTOM");
1985
- }
1957
+ setStatus("SCROLLING_TO_BOTTOM");
1986
1958
  }
1987
1959
  }
1988
- }, 50);
1989
-
1990
- return () => clearInterval(intervalId);
1960
+ }, 100);
1991
1961
  } else if (status === "SCROLLING_TO_BOTTOM") {
1992
1962
  console.log(
1993
1963
  "ACTION (SCROLLING_TO_BOTTOM): Executing scroll."