fix: refresh the slideshow in place after index updates; surface pre-scan indexing failures#345
Merged
Merged
Conversation
…leave index progress stuck on idle After an index update finished (semantic-map reindex button or Album Management), the swiper and grid kept their stale image count and slides — new images were unreachable without a page reload, and the Album Manager path additionally yanked the user back to slide 0 and cleared any active search. Both completion paths now dispatch albumChanged with a new changeType "refresh" carrying the fresh filename_count, meaning "same album, image set changed in place": - slide-state.js keeps the current position and search results, clamping against the new total (indices only shift when images were removed; out-of-range search hits are dropped, search mode exits only if none survive) - the swiper and grid rebuild through their existing listeners; the grid bumps its thumbnail cache-breaker - umap.js ignores the refresh (the map reloads via albumIndexUpdated, and re-initializing would force the window fullscreen — that quirk on the Album Manager path is gone too); the albumIndexUpdated listener reloads immediately only while the window is visible, otherwise it just marks the data stale for the next open - bookmarks and the back-stack keep their in-memory state instead of treating the refresh as an album switch Also fixes the "No operation in progress (0/0)" stuck status when updating an InvokeAI board album: the run only registered itself with the progress tracker after the board fetch and the existing-index load, and set_error dropped errors when no tracker entry existed — so a failure before scanning started (e.g. InvokeAI unreachable on the first update after a server restart) left the card polling "idle" forever with the real error only in the server log. The update endpoint now registers the operation before scheduling the background task (also closing a double-start race), the board fetch and npz load report progress steps, and set_error creates the entry it needs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related fixes to the index-update experience, verified live by the author.
1. The slideshow now refreshes in place after an index update
After an index update completed (the semantic map's reindex button from #344, or Album Management's Update Index), the UMAP reloaded but the swiper/grid kept their stale image count and slides — new images were unreachable without a full page reload. The Album Manager path additionally reset the user to slide 0 and cleared any active search.
Both completion paths now dispatch
albumChangedwith a newchangeType: "refresh"carrying the freshfilename_count, meaning "same album, image set changed in place":albumChangedlisteners; the grid bumps its thumbnail cache-breaker.albumIndexUpdated) — this also removes the old quirk where an Album Manager update of the current album forced the map window fullscreen viainitializeUmapWindow. ThealbumIndexUpdatedlistener now fetches immediately only while the window is visible; otherwise it marks the data stale for the next open.resetAllSlides()call (which rebuilt against the stale count) is removed; the refresh event does it once, correctly.2. Index progress can no longer get stuck on "No operation in progress (0/0)"
Updating an InvokeAI board album could leave the album card polling that idle status forever. Root cause was two gaps:
.npzload, so polls during that window saw no operation at all (for a large album the npz load alone is seconds of "idle").progress_tracker.set_error()silently dropped errors when no tracker entry existed — a failure before scanning started (e.g. a misconfigured/unreachable InvokeAI on the first update after a server restart) was logged server-side but invisible in the UI, permanently.Fixes: the
update_index_asyncendpoint registers the operation before scheduling the background task (which also closes a double-start race —is_runningis true from the moment of the POST), the board fetch and index load report progress steps ("Fetching board contents from InvokeAI...", "Loading existing index..."), andset_errorcreates the entry it needs. A previously-invisible InvokeAI 404 misconfiguration was surfaced by this fix during live testing.Tests
tests/frontend/slide-state-refresh.test.js(new): position/search preservation, clamping, dropped out-of-range hits, plain album switch still resets.umap-reindex.test.js: completion dispatches the refresh event with the fresh count.album-manager-progress.test.js: completion firesalbumIndexUpdated+ refresh for the current album only.test_progress.py:set_errorwith no prior entry creates a visible ERROR entry.test_invokeai_board_index.py: pre-scan failure with an empty tracker (fresh server) surfaces as "error" instead of hanging.test_index.py: the endpoint registers progress before the task runs.All suites pass: 455 backend, 411 frontend (+7 new), ruff, eslint, prettier.
🤖 Generated with Claude Code