From fbabace02377dad4b690efe0c38dd8885fb70471 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 29 Nov 2025 18:54:22 +0000 Subject: [PATCH] Fix SolidJS proxy error in batched WebSocket updates Using reconcile() inside produce() is invalid - reconcile returns a function that creates a new proxy, but produce expects direct mutations. Use batch() from solid-js instead to atomically batch the two setState calls without proxy conflicts. --- frontend-modern/src/stores/websocket.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend-modern/src/stores/websocket.ts b/frontend-modern/src/stores/websocket.ts index 8e9d461..cbdada0 100644 --- a/frontend-modern/src/stores/websocket.ts +++ b/frontend-modern/src/stores/websocket.ts @@ -1,4 +1,4 @@ -import { createSignal, onCleanup } from 'solid-js'; +import { createSignal, onCleanup, batch } from 'solid-js'; import { createStore, produce, reconcile } from 'solid-js/store'; import type { State, @@ -472,12 +472,10 @@ export function createWebSocketStore(url: string) { // Apply updates - batch together if both are present to prevent flapping if (shouldApplyDockerHosts && processedHosts !== null) { // Both dockerHosts and hosts in this message - batch them atomically - setState( - produce((s: State) => { - s.dockerHosts = reconcile(processedDockerHosts!, { key: 'id' })(s.dockerHosts); - s.hosts = reconcile(processedHosts!, { key: 'id' })(s.hosts); - }) - ); + batch(() => { + setState('dockerHosts', reconcile(processedDockerHosts!, { key: 'id' })); + setState('hosts', reconcile(processedHosts!, { key: 'id' })); + }); // Lifecycle cleanup for Docker hosts and containers const hostIds = new Set(processedDockerHosts!.map((h: DockerHost) => h.id).filter(Boolean));