@gitlab/ui 39.7.0 → 39.7.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [39.7.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v39.7.0...v39.7.1) (2022-05-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlInfiniteScroll:** Fix GlInfiniteScroll not firing bottomReached event in some cases ([d4c8d91](https://gitlab.com/gitlab-org/gitlab-ui/commit/d4c8d91aa913133ac8d3d55ab351a4660a5c2f2b))
7
+
1
8
  # [39.7.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v39.6.1...v39.7.0) (2022-05-03)
2
9
 
3
10
 
@@ -8,6 +8,7 @@ const throttleDuration = 1000;
8
8
  */
9
9
 
10
10
  const adjustScrollGap = 5;
11
+ const THRESHOLD = 1;
11
12
  var script = {
12
13
  props: {
13
14
  /**
@@ -164,9 +165,9 @@ var script = {
164
165
  },
165
166
 
166
167
  handleScroll: throttle(function handleScrollThrottled() {
167
- if (this.scrollTop() + this.maxListHeight >= this.itemsListHeight()) {
168
+ if (Math.abs(this.itemsListHeight() - this.maxListHeight - this.scrollTop()) < THRESHOLD) {
168
169
  this.bottomReached();
169
- } else if (this.scrollTop() === 0) {
170
+ } else if (this.scrollTop() <= THRESHOLD) {
170
171
  this.topReached();
171
172
  }
172
173
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "39.7.0",
3
+ "version": "39.7.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -73,7 +73,7 @@ describe('Infinite Scroll component', () => {
73
73
 
74
74
  expect(wrapper.emitted('bottomReached')).toBeFalsy();
75
75
 
76
- mockScrollTo({ top: INITIAL_HEIGHT });
76
+ mockScrollTo({ top: INITIAL_HEIGHT - 0.5 });
77
77
  expect(wrapper.emitted('bottomReached')).toBeTruthy();
78
78
  });
79
79
 
@@ -7,6 +7,7 @@ const throttleDuration = 1000;
7
7
  * Values in pixels, should be a small amount.
8
8
  */
9
9
  export const adjustScrollGap = 5;
10
+ const THRESHOLD = 1;
10
11
 
11
12
  export default {
12
13
  props: {
@@ -138,9 +139,9 @@ export default {
138
139
  return this.$refs.infiniteContainer.scrollTop;
139
140
  },
140
141
  handleScroll: throttle(function handleScrollThrottled() {
141
- if (this.scrollTop() + this.maxListHeight >= this.itemsListHeight()) {
142
+ if (Math.abs(this.itemsListHeight() - this.maxListHeight - this.scrollTop()) < THRESHOLD) {
142
143
  this.bottomReached();
143
- } else if (this.scrollTop() === 0) {
144
+ } else if (this.scrollTop() <= THRESHOLD) {
144
145
  this.topReached();
145
146
  }
146
147
  }),