Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix: publish per-terminal font steps to the Omni board live (#915)

Erik Zwep229edeb414c6
diff --git a/CLAUDE.md b/CLAUDE.md
index 7a2529bab..b21e26974 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -6508,6 +6508,9 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea
Round 2: every xterm is BUILT from the effective visual (`visualRef`, both surfaces) — a refresh
or offscreen revive recreates it in the same mount, where the live-options effect does not re-run;
and keypad 0 resets only when it types `0` (Num Lock off it is Insert, and Ctrl+Insert copies).
+ Round 3: Canvas also mirrors the step into the projects store for the ACTIVE project
+ (`patchStoredFontSize`, same epoch guard as `commitActiveToStore`), because the Omni board builds
+ its card modal's spawn from the store and would otherwise lag until the next autosave commit.
- **"Go to node" (`goToNode` → `frameNode`)** — the one camera-travel path (notification click,
sessions sidebar, ⌘K jump, presence travel, minimap double-click, double-click focus).
**It computes the viewport itself and applies it with `setViewport`. It must never go through
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index e6ec6e2dc..e1cf62ccf 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -260,6 +260,7 @@ import {
forwardedResetMatches,
nextTerminalFontSizeOverride,
normalizeTerminalFontSize,
+ patchStoredFontSize,
requestTerminalFontZoom,
type TerminalFontZoomRequest
} from '../terminal/terminal-font-zoom'
@@ -9620,6 +9621,20 @@ export function Canvas() {
setNodes((ns) =>
ns.map((n) => (n.id === d.nodeId ? { ...n, data: { ...n.data, terminalFontSize: next } } : n))
)
+ // Mirror into the projects store too (review round 3): the Omni board reads the ACTIVE
+ // project's card spawn from the store, not React Flow, so without this its focused terminal
+ // lagged until the next autosave commit — or never, while a conflict suspends autosave.
+ // Same epoch guard as `commitActiveToStore`; the next commit writes the identical value.
+ const activeId = useProjects.getState().activeProjectId
+ if (activeId && canCommitCanvas(nodesProjectIdRef.current, activeId)) {
+ useProjects.setState((st) => ({
+ projects: st.projects.map((p) => {
+ if (p.id !== activeId) return p
+ const nodes = patchStoredFontSize(p.nodes, d.nodeId, next)
+ return nodes === p.nodes ? p : { ...p, nodes }
+ })
+ }))
+ }
markDirty()
}
window.addEventListener(TERMINAL_FONT_ZOOM_EVENT, onFontZoom)
diff --git a/src/renderer/terminal/terminal-font-zoom.test.ts b/src/renderer/terminal/terminal-font-zoom.test.ts
index bc3f5d457..823b453ca 100644
--- a/src/renderer/terminal/terminal-font-zoom.test.ts
+++ b/src/renderer/terminal/terminal-font-zoom.test.ts
@@ -11,6 +11,7 @@ import {
leavesSharedGlyphAtlas,
nextTerminalFontSizeOverride,
normalizeTerminalFontSize,
+ patchStoredFontSize,
requestTerminalFontZoom,
terminalFontZoomAction,
terminalFontZoomChord,
@@ -235,3 +236,19 @@ describe('keypad Insert stays a copy chord (review round 2 of #915)', () => {
expect(terminalFontZoomChord(key({ ctrlKey: true, key: 'à', code: 'Digit0' }), false)).toBe('reset')
})
})
+
+describe('patchStoredFontSize (review round 3: Omni Kanban reads the projects store)', () => {
+ const nodes = [
+ { id: 'a', terminalFontSize: 15 },
+ { id: 'b' }
+ ]
+ it('sets and clears one node, leaving the rest untouched', () => {
+ expect(patchStoredFontSize(nodes, 'b', 17)).toEqual([{ id: 'a', terminalFontSize: 15 }, { id: 'b', terminalFontSize: 17 }])
+ expect(patchStoredFontSize(nodes, 'a', undefined)).toEqual([{ id: 'a', terminalFontSize: undefined }, { id: 'b' }])
+ expect(nodes[1]).toEqual({ id: 'b' })
+ })
+ it('returns the SAME array when nothing changes (no store churn)', () => {
+ expect(patchStoredFontSize(nodes, 'a', 15)).toBe(nodes)
+ expect(patchStoredFontSize(nodes, 'missing', 20)).toBe(nodes)
+ })
+})
diff --git a/src/renderer/terminal/terminal-font-zoom.ts b/src/renderer/terminal/terminal-font-zoom.ts
index 96ade5543..7f8f50e8e 100644
--- a/src/renderer/terminal/terminal-font-zoom.ts
+++ b/src/renderer/terminal/terminal-font-zoom.ts
@@ -177,6 +177,26 @@ export function leavesSharedGlyphAtlas(effectiveFontSize: number, globalFontSize
return effectiveFontSize !== globalFontSize
}
+/**
+ * PURE. `nodes` with one node's stored `terminalFontSize` replaced — the SAME array when the node is
+ * absent or already holds that value, so a no-op step costs no store update. Used to mirror a step
+ * into the projects store for the ACTIVE project: the Omni (all-projects) board derives its card
+ * modal's `spawn` from the store, which otherwise only catches up on the next autosave commit
+ * (~800 ms, or never while a workspace conflict suspends autosave). The mirror is idempotent with
+ * that commit, which serializes the same value from the live canvas.
+ */
+export function patchStoredFontSize<T extends { id: string; terminalFontSize?: number }>(
+ nodes: T[],
+ nodeId: string,
+ next: number | undefined
+): T[] {
+ const i = nodes.findIndex((n) => n.id === nodeId)
+ if (i < 0 || nodes[i].terminalFontSize === next) return nodes
+ const out = nodes.slice()
+ out[i] = { ...nodes[i], terminalFontSize: next }
+ return out
+}
+
/** Stamped on each terminal's xterm host (canvas node and card modal) with the node id. */
export const FONT_ZOOM_NODE_ATTR = 'data-font-zoom-node'
diff --git a/src/renderer/terminal/terminal-font-zoom.wiring.test.ts b/src/renderer/terminal/terminal-font-zoom.wiring.test.ts
index c2b34a5d0..499a7a7d9 100644
--- a/src/renderer/terminal/terminal-font-zoom.wiring.test.ts
+++ b/src/renderer/terminal/terminal-font-zoom.wiring.test.ts
@@ -121,6 +121,14 @@ describe('terminal font zoom — key wiring', () => {
expect(body).toContain('markDirty()')
})
+ it('mirrors the step into the projects store so the Omni board (which reads it) updates live', () => {
+ const start = CANVAS.indexOf('TERMINAL_FONT_ZOOM_EVENT, onFontZoom')
+ const body = CANVAS.slice(CANVAS.lastIndexOf('useEffect(', start), start)
+ expect(body).toContain('patchStoredFontSize(')
+ // Same epoch guard commitActiveToStore uses: never patch another project's stored nodes.
+ expect(body).toContain('canCommitCanvas(nodesProjectIdRef.current,')
+ })
+
it('the forwarded desktop ⌘0 resets a focused terminal BEFORE falling back to canvas zoom', () => {
const start = CANVAS.indexOf('window.nodeTerminal.onZoomActualSize(')
const body = CANVAS.slice(start, CANVAS.indexOf('})', start))