cogsbox-state 0.5.418 → 0.5.419

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.418",
3
+ "version": "0.5.419",
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
@@ -1909,13 +1909,8 @@ function createProxyHandler<T>(
1909
1909
  const isInitialLoad =
1910
1910
  previousCountRef.current === 0 && totalCount > 0;
1911
1911
 
1912
- // Only auto-scroll if we haven't scrolled away AND we're at bottom
1913
- if (
1914
- (hasNewItems || isInitialLoad) &&
1915
- wasAtBottomRef.current &&
1916
- !userHasScrolledAwayRef.current
1917
- ) {
1918
- // First, ensure the last items are in range
1912
+ if ((hasNewItems || isInitialLoad) && wasAtBottomRef.current) {
1913
+ // Only update range and scroll if we're at bottom
1919
1914
  const visibleCount = Math.ceil(
1920
1915
  (containerRef.current?.clientHeight || 0) / itemHeight
1921
1916
  );
@@ -1929,18 +1924,12 @@ function createProxyHandler<T>(
1929
1924
 
1930
1925
  setRange(newRange);
1931
1926
 
1932
- // Then scroll to the last item after it renders
1933
1927
  const timeoutId = setTimeout(() => {
1934
- const scrolled = scrollToLastItem();
1935
- if (!scrolled && containerRef.current) {
1936
- // Fallback if ref not available yet
1928
+ if (containerRef.current) {
1937
1929
  containerRef.current.scrollTop =
1938
1930
  containerRef.current.scrollHeight;
1939
1931
  }
1940
1932
  }, 50);
1941
-
1942
- previousCountRef.current = totalCount;
1943
- return () => clearTimeout(timeoutId);
1944
1933
  }
1945
1934
 
1946
1935
  previousCountRef.current = totalCount;