Gallery auto-select probe: no-op navigation discards the selection; quiet store clears it
维护者通常 2 天内回复
@lstein 已经在做这个了。
开始于 2026年8月24日。
评估
这个 Issue 还没有评估数据。
描述
The gallery's auto-select probe (app/store/middleware/listenerMiddleware/listeners/boardIdSelected.ts) exists to give the viewer something to show after a board or view change. It has three defects that are independent of each other but share a root: it treats every boardIdSelected / galleryViewChanged as a real navigation, and it depends on a condition() wait that can expire without ever being evaluated.
All of these reproduce on main. I found them while reviewing #9520 and attempted a fix there; every attempt introduced a worse regression, so I pulled it out into this issue rather than keep iterating inside an unrelated PR.
1. Navigation that changes nothing throws away your selection
NoBoardBoard dispatches boardIdSelected({ boardId: 'none' }) whether or not that board is already selected, and GalleryPanel's Images/Assets tabs dispatch galleryViewChanged on every click. GalleryBoard and VirtualBoardItem both guard against this; those two don't.
The probe re-runs and selects item_names[0] unconditionally.
- Open Uncategorized, scroll down, click an older image.
- Click Uncategorized in the boards list (the board you are already on), or the Images tab while it is already showing.
- The selection jumps to the newest item.
With a generation running it also moves the displayed item, which the viewer reads as a change worth revealing, so the progress overlay lifts for a couple of seconds.
2. A quiet store turns a board switch into a cleared selection
condition(predicate, 5000) only re-evaluates its predicate when an action is dispatched — never on its own timer. So when listGalleryItemNames is already fulfilled for the new args and nothing else dispatches, the probe never wakes, the 5 s deadline expires, and the give-up branch dispatches an empty selection.
- Visit a board so its item-name list is cached.
- Go elsewhere, then come back to it.
- Don't touch anything for five seconds.
- The selection is cleared and the viewer drops to its empty state.
Ambient traffic usually masks this — a socket event or a query landing is enough to wake it — which is why it is intermittent rather than constant.
3. Uploading to the board and view you are already on selects nothing
imageUploaded / videoUploaded dispatch boardIdSelected({ boardId }) then galleryViewChanged('assets'). When both already match the current state, the second cancels the first's probe (cancelActiveListeners() runs before the effect decides it has nothing to do), and neither selects the upload.
Why the obvious fixes don't work
Recording these because each looked right and each broke something:
- Guarding the click handlers (adding the
selectedBoardId !== …checkGalleryBoardhas) swallows the click that is the only way to recover when the selection is empty — reachable after deleting the last item, aftershowVirtualBoardsChanged(false)(which resets the board and clears the selection without dispatchingboardIdSelectedat all), and after defect 2 above. - Skipping when the displayed item is already in the fetched list breaks real board switches: a virtual date board's query args drop
board_idand filter oncreated_datealone, so its list is a superset of every board's items for that day. Switching from a real board to a date board then looks like a no-op and strands the viewer on the previous board's item, with a cross-board multi-selection surviving the switch. - Short-circuiting the wait when the list is already cached (
selectQuery(getState()).isSuccess || await condition(...)) removes the only await, so the effect completes synchronously inside the dispatch that started it. Its write then lands betweenmarkNextSelectionAutoSwitched()and the auto-switch's ownimageSelected, consuming the marker — so the auto-switch registers as a user pick and flashes the finished image over the next generation. Today an unrelated cache invalidation happens to mask it. - Skipping when the selection is merely non-empty leaves the selection stale: a search term (and any other arg change) narrows the list without starting a probe, so the selection can be non-empty and absent from what the grid shows, and the click that would fix it gets swallowed.
A fix probably wants to decide "did this navigation change anything?" from the pre-action state and keep a way to recover when the current selection isn't in the list on screen, while leaving the query wait's timing alone. Defect 2 is worth fixing on its own first, since several of the above interact with it.
- 主要语言
- TypeScript
- 星标
- 28.9k
- 派生
- 3.1k
- 平均合并
- 3 天 18 小时
- 30 天内合并 PR
- 197
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
invoke-ai/InvokeAI 的其他 Issue
-
[bug]: upload_image resize_to is documented as a stringified tuple, but only a JSON object with width and height is accepted可能已有人在做 @GuilhermeAAV 于 3 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
invoke-ai/InvokeAI#10047 · 1 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
[bug]: FLUX final-layer modulation LoRA layer is not converted (FLUX.1 diffusers: load fails, FLUX.2 BFL: layer skipped)可能已有人在做 @Pfannkuchensack 于 3 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
invoke-ai/InvokeAI#10022 · 2 条评论 ·
维护者通常 2 天内回复
-
[enhancement]: Bump PyPatchMatch to latest可能已有人在做 @dunkeroni 于 15 天前认领。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 74/100
invoke-ai/InvokeAI#9826 · 2 个 reaction · 已指派 1 人 ·
维护者通常 2 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 62/100
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 2 天内回复
查看 invoke-ai/InvokeAI 的全部 Issue
相似的 Issue
-
area:cli bug P4
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug from-studio
难度 2/5 1-3 小时 新手友好度 65/100
esengine/DeepSeek-Reasonix#14868 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
loopbackio/loopback-next#11878 ·
维护者通常 2 天内回复
-
bug 🐛
难度 2/5 1-3 小时 新手友好度 78/100
comunica/comunica#1925 · 1 条评论 ·
维护者通常 1 天内回复