fix(virtual-scroll): avoid full reload on move-to-folder, scroll to top on filter/page reset

- MoveManager/SidebarManager: replace resetAndReload with in-place
  VirtualScroller update after move operations (remove non-visible,
  update visible items' file_path). Preserves scroll position and
  avoids empty grid.
- VirtualScroller: add removeMultipleItemsByFilePath for efficient
  batch removal with Array.isArray guard.
- baseModelApi: scroll to top on loadMoreWithVirtualScroll(true),
  covering filter/sort/search/folder/views changes.
- SidebarManager selectFolder: scroll now handled centrally.
This commit is contained in:
Will Miao
2026-06-19 09:18:49 +08:00
parent b24b1a7e57
commit 07f49559be
4 changed files with 232 additions and 29 deletions

View File

@@ -133,6 +133,16 @@ export class BaseModelApiClient {
pageState.hasMore = result.hasMore;
pageState.currentPage = pageState.currentPage + 1;
// When resetting to page 1, scroll back to the top
// This covers: folder selection, filter/sort/search changes,
// favorites/update/excluded view toggles, alphabet filter, etc.
if (resetPage) {
const scrollContainer = document.querySelector('.page-content');
if (scrollContainer) {
scrollContainer.scrollTop = 0;
}
}
if (updateFolders) {
sidebarManager.refresh();
}