Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(agentic-ide): hold the weight rebase while a seam is being dragged
Ruben Lütke633dd7445522
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex f9e029b1ae..0a9ed1ca37 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -1637,6 +1637,51 @@ describe("resizing the workspace", () => {}});+ it("does not remap a second time when the session catches up with the grid's own action", async () => {+ // The grid's own split remaps (and rebases) in the same breath as the+ // request; the session prop then arrives describing the same arrangement.+ // Reading that as fresh drift would remap already-remapped weights.+ const next = sessionWith([["Mika", 0], ["New", 1], ["Nova", 2]]);+ vi.mocked(api.addTerminal).mockResolvedValue(next);+ const restore = measured(1800, 600);+ try {+ const { rerender } = renderGrid(sessionWith([["Mika", 0], ["Nova", 1]]));+ fireEvent.click(screen.getByTestId("pane-split-right-Mika"));+ await waitFor(() => expect(stored().columns).toEqual([0.5, 0.5, 1]));++ rerender({ session: next });++ expect(stored().columns).toEqual([0.5, 0.5, 1]);+ expect(widthOf("Mika")).toBe(25);+ expect(widthOf("Nova")).toBe(50);+ } finally {+ restore();+ }+ });++ it("waits out a seam drag before answering outside drift, then answers it", async () => {+ const restore = measured(1800, 600);+ try {+ const { rerender } = renderGrid(+ sessionWith([["Mika", 0], ["Nova", 1], ["Aria", 2]]),+ );+ dragSeamBy("pane-seam-column:1:2", 1200, 900);+ expect(widthOf("Aria")).toBe(50);++ // Grab a seam and, while the pointer is down, let the workspace change+ // under the gesture. The remap must not fight the drag's direct painting+ // — and must still land once the pointer is released.+ holdSeam("pane-seam-column:0:1", 600);+ rerender({ session: sessionWith([["Nova", 0], ["Aria", 1]]) });+ act(() => window.dispatchEvent(new MouseEvent("pointerup")));++ expect(widthOf("Aria")).toBe(75);+ expect(widthOf("Nova")).toBe(25);+ } finally {+ restore();+ }+ });+it("does not read a rename as a rearrangement", async () => {vi.mocked(api.renameTerminal).mockResolvedValue(sessionWith([["Frontend", 0], ["Nova", 1]]),diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 6e9f26b481..da66faf369 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -865,24 +865,33 @@ export function AgenticGrid({useEffect(() => {// A workspace switch loads that workspace's weights (see `usePaneWeights`),// so the basis switches with it: its stored arrangement when one survives,- // otherwise the session as it stands — never the outgoing workspace's.+ // otherwise the session as it stands — never the outgoing workspace's. A+ // workspace seen for the first time stores its arrangement right away,+ // because the stored copy is what makes the weights readable after a+ // restart behind which the workspace changed.if (weightsBasisFor.current !== session.id) {weightsBasisFor.current = session.id;- weightsBasis.current =- loadStoredArrangement(session.id) ?? paneArrangement(session.terminals);+ const stored = loadStoredArrangement(session.id);+ weightsBasis.current = stored ?? paneArrangement(session.terminals);+ if (!stored) saveStoredArrangement(session.id, weightsBasis.current);}const basis = weightsBasis.current;const current = paneArrangement(session.terminals);- if (basis && !sameArrangement(basis, current)) {- // Runs AFTER the hook's own load effect in the same commit, so on a- // workspace switch this updater already sees that workspace's weights.- sizes.setWeights((weights) =>- remapColumnWeights(weights, panesFromArrangement(basis), session.terminals),- );- }+ if (!basis || sameArrangement(basis, current)) return;+ // Never mid-drag. The gesture paints the panes directly and commits its+ // weights from a snapshot taken at pointer-down (see `usePaneWeights`), so+ // a remap here would both be clobbered by that commit and re-render every+ // live terminal under the pointer. `sizes.dragging` is a dependency, so+ // the drift is answered the moment the pointer is released.+ if (sizes.dragging !== null) return;+ // Runs AFTER the hook's own load effect in the same commit, so on a+ // workspace switch this updater already sees that workspace's weights.+ sizes.setWeights((weights) =>+ remapColumnWeights(weights, panesFromArrangement(basis), session.terminals),+ );weightsBasis.current = current;saveStoredArrangement(session.id, current);- }, [session.id, session.terminals, sizes.setWeights]);+ }, [session.id, session.terminals, sizes.dragging, sizes.setWeights]);/** Hold the dragged sizes against anything else that renders mid-gesture.