Skip to content

Commit

Permalink
fix (virtual): virtual scroll in fileviewer
Browse files Browse the repository at this point in the history
there was an issue from a page viewer virtual scroll enabled typing a
search that would return a small amount of result with a scrollbar.

in those condition the scroll event would still be called with the
previous incorrect data
  • Loading branch information
mickael-kerjean committed Dec 29, 2024
1 parent 0a2f3c6 commit 23c5bf5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions public/assets/pages/filespage/ctrl_filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default async function(render) {
/// ///////////////////////////////////
// CASE 1: virtual scroll isn't enabled
if (files.length <= VIRTUAL_SCROLL_MINIMUM_TRIGGER) {
return rxjs.EMPTY;
return rxjs.of({ virtual: false });
}

/// ///////////////////////////////////
Expand All @@ -157,6 +157,7 @@ export default async function(render) {
setHeight(0);
const top = ($node) => $node.getBoundingClientRect().top;
return rxjs.of({
virtual: true,
files,
read_only,
path,
Expand All @@ -176,9 +177,14 @@ export default async function(render) {
BLOCK_SIZE, COLUMN_PER_ROW, FILE_HEIGHT,
MARGIN,
currentState,
/* height, */ setHeight,
setHeight,
$list,
}) => rxjs.fromEvent($page.closest(".scroll-y"), "scroll", { passive: true }).pipe(
virtual,
}) => (
virtual ?
rxjs.fromEvent($page.closest(".scroll-y"), "scroll", { passive: true }) :
rxjs.EMPTY
).pipe(
rxjs.map((e) => {
// 0-------------0-----------1-----------2-----------3 ....
// [padding] $block1 $block2 $block3 ....
Expand Down

0 comments on commit 23c5bf5

Please sign in to comment.