The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): track kanban lane phase in state, not a mirrored ref
Brooklyn Nicholson1238efce135d
diff --git a/apps/desktop/src/lib/keybinds/contributed-actions.test.ts b/apps/desktop/src/lib/keybinds/contributed-actions.test.tsindex e5eb72b149d..0b82242789f 100644--- a/apps/desktop/src/lib/keybinds/contributed-actions.test.ts+++ b/apps/desktop/src/lib/keybinds/contributed-actions.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from 'vitest'-import { registry } from '@/contrib/registry'import { createPluginContext } from '@/contrib/plugin'+import { registry } from '@/contrib/registry'import { allKeybindActions, contributedKeybindHandler, KEYBINDS_AREA } from '@/lib/keybinds/actions'import { bindingsFor } from '@/store/keybinds'diff --git a/apps/desktop/src/plugins/kanban/board.tsx b/apps/desktop/src/plugins/kanban/board.tsxindex a68f3fafdc1..fa53a26f969 100644--- a/apps/desktop/src/plugins/kanban/board.tsx+++ b/apps/desktop/src/plugins/kanban/board.tsx@@ -1244,28 +1244,37 @@ export function KanbanBoardPage() {// override is dropped and auto takes over — so a drained lane collapses even// if it was manually expanded ages ago, while expanding an empty lane still// sticks for as long as it stays empty.- const laneCounts = useRef<null | Record<string, number>>(null)+ //+ // The phase is a string signature held in state, not a ref: React bails out+ // when it's unchanged, so the common case (a poll where no lane's emptiness+ // moved) costs no extra render, and nothing lags a render behind the value+ // it mirrors.+ const lanePhase = filtered+ ? filtered.columns.map(col => `${col.name}:${col.tasks.length === 0 ? 'empty' : 'full'}`).join('|')+ : null++ const [prevLanePhase, setPrevLanePhase] = useState<null | string>(null)useEffect(() => {- if (!filtered) {+ if (lanePhase === null || lanePhase === prevLanePhase) {return}- const counts = Object.fromEntries(filtered.columns.map(col => [col.name, col.tasks.length]))- const prev = laneCounts.current- laneCounts.current = counts+ setPrevLanePhase(lanePhase)- if (!prev) {+ if (prevLanePhase === null) {return}+ const before = new Map(prevLanePhase.split('|').map(entry => entry.split(':') as [string, string]))const overrides = { ...$collapsedLanes.get() }let changed = false- for (const [name, count] of Object.entries(counts)) {- const before = prev[name]+ for (const entry of lanePhase.split('|')) {+ const [name, phase] = entry.split(':')+ const was = before.get(name)- if (before !== undefined && (before === 0) !== (count === 0) && name in overrides) {+ if (was !== undefined && was !== phase && name in overrides) {delete overrides[name]changed = true}@@ -1274,7 +1283,7 @@ export function KanbanBoardPage() {if (changed) {$collapsedLanes.set(overrides)}- }, [filtered])+ }, [lanePhase, prevLanePhase])const toggleLane = (name: string, auto: boolean) => {const overrides = { ...laneOverrides }