From 7e25f20e746f1ba24e8772ccd59beac4be74fcd1 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Thu, 30 Oct 2025 14:40:37 +0000 Subject: [PATCH] Disable macOS spellchecker and simplify reactive lists --- electron/main/main.ts | 5 + src/components/instance-tabs.tsx | 23 ++--- src/components/logs-view.tsx | 97 ++++---------------- src/components/session-list.tsx | 151 ++++++++++++++++--------------- 4 files changed, 115 insertions(+), 161 deletions(-) diff --git a/electron/main/main.ts b/electron/main/main.ts index 001cd3ae..747238e8 100644 --- a/electron/main/main.ts +++ b/electron/main/main.ts @@ -4,6 +4,8 @@ import { createApplicationMenu } from "./menu" import { setupInstanceIPC } from "./ipc" import { setupStorageIPC } from "./storage" +app.commandLine.appendSwitch("disable-spell-checking") + // Setup IPC handlers before creating windows setupStorageIPC() @@ -27,6 +29,9 @@ function createWindow() { }, }) + // Disable macOS spell server to avoid input lag + mainWindow.webContents.session.setSpellCheckerEnabled(false) + if (process.env.NODE_ENV === "development") { mainWindow.loadURL("http://localhost:3000") mainWindow.webContents.openDevTools() diff --git a/src/components/instance-tabs.tsx b/src/components/instance-tabs.tsx index 68fcf18c..4fe8c7a1 100644 --- a/src/components/instance-tabs.tsx +++ b/src/components/instance-tabs.tsx @@ -18,18 +18,15 @@ const InstanceTabs: Component = (props) => {
- - {(id) => { - const instance = props.instances.get(id) - return ( - props.onSelect(id)} - onClose={() => props.onClose(id)} - /> - ) - }} + + {([id, instance]) => ( + props.onSelect(id)} + onClose={() => props.onClose(id)} + /> + )}
- 1}> + 1}>
= (props) => { const instance = () => instances().get(props.instanceId) const logs = () => instance()?.logs ?? [] - let renderedCount = 0 - let initialSyncDone = false - let emptyStateEl: HTMLDivElement | null = null - onMount(() => { if (scrollRef && savedState) { scrollRef.scrollTop = savedState.scrollTop @@ -36,6 +32,11 @@ const LogsView: Component = (props) => { } }) + createEffect(() => { + if (autoScroll() && scrollRef && logs().length > 0) { + scrollRef.scrollTop = scrollRef.scrollHeight + } + }) const handleScroll = () => { if (!scrollRef) return @@ -75,78 +76,6 @@ const LogsView: Component = (props) => { } } - const createLogElement = (entry: LogEntry) => { - const row = document.createElement("div") - row.className = "log-entry" - - const timestamp = document.createElement("span") - timestamp.className = "log-timestamp" - timestamp.textContent = formatTime(entry.timestamp) - - const message = document.createElement("span") - message.className = `log-message ${getLevelColor(entry.level)}` - message.textContent = entry.message - - row.append(timestamp, message) - return row - } - - createEffect(() => { - const entries = logs() - if (!scrollRef) return - - if (entries.length < renderedCount) { - scrollRef.innerHTML = "" - renderedCount = 0 - initialSyncDone = false - if (emptyStateEl && emptyStateEl.parentElement) { - emptyStateEl.parentElement.removeChild(emptyStateEl) - } - } - - if (entries.length === 0) { - renderedCount = 0 - if (!emptyStateEl) { - emptyStateEl = document.createElement("div") - emptyStateEl.className = "log-empty-state" - emptyStateEl.textContent = "Waiting for server output..." - } - if (emptyStateEl.parentElement !== scrollRef) { - scrollRef.appendChild(emptyStateEl) - } - return - } - - if (emptyStateEl && emptyStateEl.parentElement === scrollRef) { - scrollRef.removeChild(emptyStateEl) - } - - for (let i = renderedCount; i < entries.length; i++) { - const entry = entries[i] - scrollRef.appendChild(createLogElement(entry)) - } - - renderedCount = entries.length - - if (!initialSyncDone) { - if (savedState) { - const maxScrollTop = Math.max(scrollRef.scrollHeight - scrollRef.clientHeight, 0) - const target = Math.min(savedState.scrollTop, maxScrollTop) - scrollRef.scrollTop = target - setAutoScroll(savedState.autoScroll) - } else { - scrollRef.scrollTop = scrollRef.scrollHeight - setAutoScroll(true) - } - initialSyncDone = true - return - } - - if (autoScroll()) { - scrollRef.scrollTop = scrollRef.scrollHeight - } - }) - return (
@@ -178,7 +107,21 @@ const LogsView: Component = (props) => { ref={scrollRef} onScroll={handleScroll} class="log-content" - >
+ > + 0} + fallback={
Waiting for server output...
} + > + + {(entry) => ( +
+ {formatTime(entry.timestamp)} + {entry.message} +
+ )} +
+
+
-
- ) - } + + {(item) => ( +
+ -
- ) - }} +
+ +
+ )}
- 0}> + 0}>
Agent Sessions
- - {(id) => { - const session = props.sessions.get(id) - if (!session) return null + + {(item) => ( +
+ -
- ) - }} + {item.title} + + + { + event.stopPropagation() + item.onClose?.() + }} + role="button" + tabIndex={0} + aria-label="Close session" + > + + + + +
+ )}