cogsbox-state 0.5.407 → 0.5.409

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.407",
3
+ "version": "0.5.409",
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
@@ -1803,10 +1803,6 @@ function createProxyHandler<T>(
1803
1803
  return selectedIndex ?? -1;
1804
1804
  };
1805
1805
  }
1806
- // Simplified useVirtualView approach
1807
- // Optimal approach - replace the useVirtualView implementation
1808
- // Complete useVirtualView implementation with comprehensive logging
1809
- // Complete fixed useVirtualView implementation
1810
1806
  // Complete fixed useVirtualView implementation
1811
1807
  if (prop === "useVirtualView") {
1812
1808
  return (
@@ -1929,7 +1925,7 @@ function createProxyHandler<T>(
1929
1925
  const { scrollTop, scrollHeight, clientHeight } = container;
1930
1926
  const currentBottom = scrollTop + clientHeight;
1931
1927
  const actualBottom = scrollHeight;
1932
- const isAtBottom = actualBottom - currentBottom < 5;
1928
+ const isAtBottom = actualBottom - currentBottom < 50; // Increased tolerance
1933
1929
 
1934
1930
  if (isAtBottom || attempts >= maxAttempts) {
1935
1931
  clearInterval(scrollToBottomIntervalRef.current!);
@@ -1967,15 +1963,17 @@ function createProxyHandler<T>(
1967
1963
  }
1968
1964
 
1969
1965
  // This is a real user scroll
1966
+ const { scrollTop, scrollHeight, clientHeight } = container;
1967
+ const distanceFromBottom =
1968
+ scrollHeight - scrollTop - clientHeight;
1969
+ const isAtBottom = distanceFromBottom < 50; // Increased tolerance
1970
+
1971
+ // Stop any auto-scrolling if user scrolls
1970
1972
  if (scrollToBottomIntervalRef.current) {
1971
1973
  clearInterval(scrollToBottomIntervalRef.current);
1972
1974
  scrollToBottomIntervalRef.current = null;
1973
1975
  }
1974
1976
 
1975
- const { scrollTop, scrollHeight, clientHeight } = container;
1976
- const isAtBottom =
1977
- scrollHeight - scrollTop - clientHeight < 10;
1978
-
1979
1977
  // Only update this for real user scrolls
1980
1978
  shouldStickToBottomRef.current = isAtBottom;
1981
1979