cogsbox-state 0.5.371 → 0.5.372

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.371",
3
+ "version": "0.5.372",
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
@@ -1949,16 +1949,16 @@ function createProxyHandler<T>(
1949
1949
 
1950
1950
  if (lastItemHeight > 0) {
1951
1951
  clearInterval(intervalId);
1952
- console.log(
1953
- "ACTION (GETTING_HEIGHTS): Measurement success -> SCROLLING_TO_BOTTOM"
1954
- );
1955
- setStatus("SCROLLING_TO_BOTTOM");
1952
+ if (!shouldNotScroll.current) {
1953
+ console.log(
1954
+ "ACTION (GETTING_HEIGHTS): Measurement success -> SCROLLING_TO_BOTTOM"
1955
+ );
1956
+
1957
+ setStatus("SCROLLING_TO_BOTTOM");
1958
+ }
1956
1959
  }
1957
1960
  }, 100);
1958
- } else if (
1959
- status === "SCROLLING_TO_BOTTOM" &&
1960
- !shouldNotScroll.current
1961
- ) {
1961
+ } else if (status === "SCROLLING_TO_BOTTOM") {
1962
1962
  console.log(
1963
1963
  "ACTION (SCROLLING_TO_BOTTOM): Executing scroll."
1964
1964
  );
@@ -2000,20 +2000,23 @@ function createProxyHandler<T>(
2000
2000
 
2001
2001
  const handleUserScroll = () => {
2002
2002
  // This is the core logic you wanted.
2003
- if (status !== "IDLE_NOT_AT_BOTTOM") {
2004
- const isAtBottom =
2005
- container.scrollHeight -
2006
- container.scrollTop -
2007
- container.clientHeight <
2008
- 1;
2009
- if (!isAtBottom) {
2010
- console.log(
2011
- "USER ACTION: Scrolled up -> IDLE_NOT_AT_BOTTOM"
2012
- );
2013
- shouldNotScroll.current = true;
2014
- setStatus("IDLE_NOT_AT_BOTTOM");
2015
- }
2003
+
2004
+ const isAtBottom =
2005
+ container.scrollHeight -
2006
+ container.scrollTop -
2007
+ container.clientHeight <
2008
+ 1;
2009
+
2010
+ if (!isAtBottom) {
2011
+ console.log(
2012
+ "USER ACTION: Scrolled up -> IDLE_NOT_AT_BOTTOM"
2013
+ );
2014
+
2015
+ setStatus("IDLE_NOT_AT_BOTTOM");
2016
+ } else {
2017
+ shouldNotScroll.current = false;
2016
2018
  }
2019
+
2017
2020
  // We always update the range, regardless of state.
2018
2021
  // This is the full, non-placeholder function.
2019
2022
  const { scrollTop, clientHeight } = container;