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.

feat(browser): one reload path, and give the web node one at all

Bas Miliusd9baf04aadd2
diff --git a/src/renderer/nodes/BrowserSurface.tsx b/src/renderer/nodes/BrowserSurface.tsx
index 5e68bb055..6fbf97a1f 100644
--- a/src/renderer/nodes/BrowserSurface.tsx
+++ b/src/renderer/nodes/BrowserSurface.tsx
@@ -259,7 +259,7 @@ export function BrowserSurface({
// A navigation with an initiator: whatever it navigates to is not a restore echo.
restoringNavRef.current = null
locationRef.current = safe
- if (safe === src) ref.current?.reload()
+ if (safe === src) reloadWebview(ref.current, false)
else setSrc(safe)
}
@@ -274,8 +274,8 @@ export function BrowserSurface({
</button>
<button
className="browser-node__btn"
- onClick={() => (loading ? ref.current?.stop() : ref.current?.reload())}
- title={loading ? 'Stop' : 'Reload'}
+ onClick={(e) => (loading ? ref.current?.stop() : reloadWebview(ref.current, e.shiftKey))}
+ title={loading ? 'Stop' : 'Reload (Shift to bypass the cache)'}
>
{loading ? '✕' : '⟳'}
</button>
diff --git a/src/renderer/nodes/WebNode.tsx b/src/renderer/nodes/WebNode.tsx
index 40fcbbd6e..e5e9cd70e 100644
--- a/src/renderer/nodes/WebNode.tsx
+++ b/src/renderer/nodes/WebNode.tsx
@@ -173,6 +173,15 @@ export default function WebNode({ id, data, selected }: NodeProps<CanvasNode>) {
{title}
</span>
<span className="term-node__spacer" />
+ {live && (
+ <button
+ className="term-node__close"
+ title="Reload (Shift to bypass the cache)"
+ onClick={(e) => reloadWebview(wvRef.current, e.shiftKey)}
+ >
+ ⟳
+ </button>
+ )}
{url && (
<button
className="term-node__close"
diff --git a/src/renderer/nodes/webview-reload-parity.test.ts b/src/renderer/nodes/webview-reload-parity.test.ts
new file mode 100644
index 000000000..a5666b9dd
--- /dev/null
+++ b/src/renderer/nodes/webview-reload-parity.test.ts
@@ -0,0 +1,25 @@
+// Two surfaces reload a guest — the canvas WebNode's header button and the BrowserSurface toolbar
+// shared by the browser node and the kanban card modal. Both must go through `reloadWebview`, which
+// is where the two rules live: Shift bypasses the cache and never silently falls back to a cached
+// re-fetch, and a guest that has not attached yet throws instead of reloading. Calling the element's
+// own methods works in the happy path and loses both, which is exactly the "simplification" a later
+// refactor reaches for — so it is pinned at source level.
+import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import path from 'node:path'
+
+const read = (file: string): string => readFileSync(path.join(__dirname, file), 'utf8')
+
+const SURFACES = ['WebNode.tsx', 'BrowserSurface.tsx']
+
+describe('every reload path goes through reloadWebview', () => {
+ it.each(SURFACES)('%s reloads through the helper, carrying the Shift modifier', (file) => {
+ const src = read(file)
+ expect(src).toContain("from './webviewReload'")
+ expect(src).toMatch(/reloadWebview\([^)]*e\.shiftKey\)/)
+ })
+
+ it.each(SURFACES)('%s never calls the guest reload methods directly', (file) => {
+ expect(read(file)).not.toMatch(/\.current\??\.reload(IgnoringCache)?\s*\(/)
+ })
+})