cogsbox-state 0.5.408 → 0.5.410

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.408",
3
+ "version": "0.5.410",
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
@@ -1925,27 +1925,20 @@ function createProxyHandler<T>(
1925
1925
  const { scrollTop, scrollHeight, clientHeight } = container;
1926
1926
  const currentBottom = scrollTop + clientHeight;
1927
1927
  const actualBottom = scrollHeight;
1928
- const isAtBottom = actualBottom - currentBottom < 50; // Increased tolerance
1928
+ const isAtBottom = actualBottom - currentBottom < 10; // Increased tolerance
1929
1929
 
1930
1930
  if (isAtBottom || attempts >= maxAttempts) {
1931
1931
  clearInterval(scrollToBottomIntervalRef.current!);
1932
1932
  scrollToBottomIntervalRef.current = null;
1933
-
1934
- // Do one final scroll to ensure we're truly at bottom
1935
- if (
1936
- isAtBottom &&
1937
- container.scrollTop <
1938
- container.scrollHeight - container.clientHeight
1939
- ) {
1940
- container.scrollTop = container.scrollHeight;
1941
- }
1942
1933
  } else {
1943
- // Only scroll if we're not already scrolling there
1944
- const targetScroll =
1945
- container.scrollHeight - container.clientHeight;
1946
- if (Math.abs(container.scrollTop - targetScroll) > 1) {
1947
- container.scrollTop = container.scrollHeight;
1948
- }
1934
+ // Set flag before scrolling
1935
+ isProgrammaticScrollRef.current = true;
1936
+ container.scrollTop = container.scrollHeight;
1937
+
1938
+ // Reset flag after a short delay
1939
+ setTimeout(() => {
1940
+ isProgrammaticScrollRef.current = false;
1941
+ }, 50);
1949
1942
  }
1950
1943
  }, 100);
1951
1944