Skip to content

Commit

Permalink
Fix endless lazy loading indicator after sorting file table (#8988)
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen authored May 5, 2023
1 parent 548ff61 commit 9f96710
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-endless-lazy-loading-when-sorting
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Endless lazy loading indicator after sorting file table

The endless lazy loading indicator when sorting the file table and re-entering it has been fixed.

https://github.com/owncloud/web/issues/6434
https://github.com/owncloud/web/pull/8988
9 changes: 8 additions & 1 deletion packages/design-system/src/composables/useIsVisible/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ export const useIsVisible = ({ target, mode = 'show', rootMargin = '100px' }) =>

const isVisible = ref(false)
const observer = new IntersectionObserver(
([{ isIntersecting }]) => {
(intersectionObserverEntries: IntersectionObserverEntry[]) => {
/**
* In some edge cases intersectionObserverEntries contains 2 entries with the first one having wrong rootBounds.
* This happens for some reason when the table is being re-sorted immediately after being rendered.
* Therefore we always check the last entry for isIntersecting.
*/
const isIntersecting = intersectionObserverEntries.at(-1).isIntersecting

isVisible.value = isIntersecting
/**
* if given mode is `showHide` we need to keep the observation alive.
Expand Down

0 comments on commit 9f96710

Please sign in to comment.