Comfy-Org / Comfy-Org/ComfyUI_frontend
Minimap keeps the old palette after a theme switch until the next graph edit
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 704
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 512
Description
## Summary
The minimap reads the colour palette at draw time but no digest term covers it, so after
#15029 a theme switch leaves the minimap rendered in the old palette until some unrelated
graph edit happens to move a digest.
## Mechanism
`getMinimapColors()` (`src/renderer/extensions/minimap/minimapCanvasRenderer.ts:16-33`)
reads `colorPaletteStore.completedActivePalette.light_theme` and derives node fill, default
fill, link, slot, group and bypass colours plus the `adjustColor` branches. It is called
once per draw at `:264`.
Neither `computeLayoutDigest`'s geometry nor visual digest mixes anything palette-derived
(`src/renderer/extensions/minimap/composables/useMinimapGraph.ts:72-105`), and there is no
watcher on the palette anywhere in the minimap stack. `useMinimapSettings.isLightTheme`
exists but only feeds the viewport rectangle border in `useMinimap.ts`.
## Repro
1. Open a workflow with the minimap visible.
2. Switch the colour palette dark to light (or the reverse).
3. Do not touch the graph.
The viewport rectangle border flips immediately, because that is reactive CSS. Every node,
link and group inside the minimap canvas stays in the previous palette. It corrects itself
on the next digest-moving change: a node move, a group edit, an execution state change, or
an add/remove.
## Why this is worth fixing now rather than before
The stale-palette behaviour is older than #15029, but #15029 made repaints digest-gated and
removed the unconditional `forceFullRedraw()` on `graphChanged`. Before, almost any graph
event healed it. Now only a digest-moving change does, so the window is strictly wider.
## Suggested fix
Mix a palette identity into the visual digest, so a theme switch moves it like any other
visual change:
```ts
visual = mixIn(visual, hashString(colorPaletteStore.completedActivePalette.id))
```
A watcher on the palette that calls `forceFullRedraw()` would also work and is arguably
clearer, since a theme switch is not a graph change.
## Affected area
- `src/renderer/extensions/minimap/composables/useMinimapGraph.ts`
- `src/renderer/extensions/minimap/minimapCanvasRenderer.ts`
Found while reviewing #15029. Verified against `main` at 4c5afc8127.
Contributor guide
Assessment
This issue has not been assessed yet.