Fix infinite scroll loading multiple pages — lock until queue drained

Keep _loading=True during the entire staggered append process.
Only unlock after the last post is added to the grid, preventing
reached_bottom from triggering new fetches mid-drain.
This commit is contained in:
pax 2026-04-05 14:58:06 -05:00
parent 6524104008
commit cd3946c494

View File

@ -821,7 +821,6 @@ class BooruApp(QMainWindow):
self._status.showMessage(f"{len(self._posts)} results (end)") self._status.showMessage(f"{len(self._posts)} results (end)")
return return
self._shown_post_ids.update(p.id for p in posts) self._shown_post_ids.update(p.id for p in posts)
QTimer.singleShot(100, self._clear_loading)
if not hasattr(self, '_append_queue'): if not hasattr(self, '_append_queue'):
self._append_queue = [] self._append_queue = []
@ -862,7 +861,8 @@ class BooruApp(QMainWindow):
if self._append_queue: if self._append_queue:
QTimer.singleShot(50, self._drain_append_queue) QTimer.singleShot(50, self._drain_append_queue)
else: else:
# All done — prefetch # All done — unlock loading and prefetch
self._loading = False
if self._db.get_setting_bool("prefetch_adjacent"): if self._db.get_setting_bool("prefetch_adjacent"):
self._prefetch_adjacent(idx) self._prefetch_adjacent(idx)