mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
fix (virtual): virtual scroll in fileviewer
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
This commit is contained in:
parent
0a2f3c6b3c
commit
23c5bf53f5
1 changed files with 9 additions and 3 deletions
|
|
@ -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 });
|
||||
}
|
||||
|
||||
/// ///////////////////////////////////
|
||||
|
|
@ -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,
|
||||
|
|
@ -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 ....
|
||||
|
|
|
|||
Loading…
Reference in a new issue