@vendorflow/components 2.0.38 → 2.0.39

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.
@@ -113,9 +113,10 @@ function useInfiniteScroll(_a) {
113
113
  }
114
114
  observer.current = new IntersectionObserver(function (entries) {
115
115
  if (entries[0].isIntersecting && hasNextPage && fetchNextPage) {
116
- if (scrollBody.current && isReverse) {
116
+ if (scrollBody.current && isReverse && hasScrollbar) {
117
117
  // save the last element, so that we can scroll to it after the new data loads in
118
118
  prevPosition.current = scrollBody.current.clientHeight;
119
+ console.log('saving prev position: ', prevPosition.current);
119
120
  }
120
121
  // load the next page
121
122
  fetchNextPage();
@@ -126,12 +127,13 @@ function useInfiniteScroll(_a) {
126
127
  });
127
128
  if (node) {
128
129
  if (isReverse && scrollParent.current && prevPosition.current != null) {
130
+ console.log('scrolling to prev position: ', prevPosition.current);
129
131
  // If we had a prev position, then we want to scroll to it
130
132
  scrollParent.current.scrollTo(0, scrollBody.current.clientHeight - prevPosition.current);
131
133
  prevPosition.current = null;
132
134
  }
133
135
  observer.current.observe(node);
134
136
  }
135
- }, [isLoading, isFetching, isReverse, hasNextPage, fetchNextPage, scrollParent, scrollBody]);
137
+ }, [isLoading, isFetching, isReverse, hasNextPage, fetchNextPage, scrollParent, scrollBody, hasScrollbar]);
136
138
  }
137
139
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendorflow/components",
3
- "version": "2.0.38",
3
+ "version": "2.0.39",
4
4
  "description": "React components for vendorflow",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",