Skip to content

feat(gallery): refresh when other clients complete generations - #9876

Merged
lstein merged 2 commits into
mainfrom
lstein/feat/gallery-refresh-external-generations
Oct 17, 2026
Merged

lstein merged 2 commits into
mainfrom
lstein/feat/gallery-refresh-external-generations

Conversation

@lstein

@lstein lstein commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

An external program (e.g. a chatbot or script) that authenticates over REST and enqueues a generation with POST /api/v1/queue/default/enqueue_batch produced images that never appeared in an open web UI tab until reload: the gallery only refreshed on uploads, reconnects, and items the tab itself tracked.

Now the gallery runtime also listens for queue_item_status_changed and runs its existing coalesced/throttled invalidation (item lists, totals, boards and board counts) when an item completes that:

  • belongs to the signed-in user (admins' copies of other users' events and everyone else's redacted copies are ignored; single-user mode accepts all), and
  • was not enqueued by the web UI itself (origin not webv2:), whose results the queue runtime already routes in the enqueuing tab.

No auto-selection; that is a separate follow-up. The App composition injects the user and origin checks, so Gallery does not depend on Queue's origin format. getSessionUserId moved from the recall runtime into Identity so both App runtimes share it.

Related Issues / Discussions

None.

QA Instructions

  • pnpm check:release (in invokeai/frontend/webv2): passes. Run on Node 24.18.0 (.nvmrc pins 22.14.0). ConceptRow.browser.test.tsx ("keeps a drag local to its row…") is flaky independent of this change: it also fails intermittently on unmodified main.
  • Manual, multi-user server: open the UI as user A and show the gallery. From a script, log in as A (POST /api/v1/auth/login) and enqueue a graph with a single blank_image node (is_intermediate: false, optional board: {board_id}) and origin: "external:test". The image appears in the gallery and the board count updates without reload, both with and without a board. It is not auto-selected.

Review

Resolved: Gallery no longer imports Queue's event type or origin classifier (injected from App instead); comments state the limitation precisely; a test covers reading the session user per event; a new leaf module that entered the editor's initial source-owner graph was folded into Identity's session module.

Known limitation: items enqueued by the same user's other web UI tab or device still refresh only the enqueuing tab (unchanged behavior). Covering them here would double-refresh the enqueuing tab.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Meaningful regression coverage added / updated where needed; obsolete tests/code removed
  • Persisted-state and API changes include required migrations / compatibility validation
  • Relevant performance/efficiency opportunities considered; material claims have evidence
  • Material review findings resolved and relevant checks rerun
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Completed queue items owned by the signed-in user and enqueued outside the web UI now refresh the gallery and board counts.
Move the session user id helper into identity so app runtimes share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the frontend PRs that change frontend files label Oct 16, 2026
@lstein
lstein requested a review from joshistoast October 16, 2026 01:20
@lstein lstein added the 7.0.0 label Oct 16, 2026
@lstein
lstein enabled auto-merge (squash) October 17, 2026 21:58
@lstein
lstein merged commit 38c896c into main Oct 17, 2026
16 checks passed
@lstein
lstein deleted the lstein/feat/gallery-refresh-external-generations branch October 17, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.0.0 frontend PRs that change frontend files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants