diff --git a/apps/cli/src/start.ts b/apps/cli/src/start.ts index a128b1fc64..89cccc70e0 100644 --- a/apps/cli/src/start.ts +++ b/apps/cli/src/start.ts @@ -130,6 +130,9 @@ export async function runStart({ attachBackendExitHandler(backendProc, supervisor); + const healthTimeoutMs = resolveHealthTimeoutMs(HEALTH_TIMEOUT_MS_RELEASE); + await waitForHealth(ports.backendUrl, backendProc, healthTimeoutMs); + // Use standalone server.js directly (not pnpm start) const webUrl = `http://localhost:${ports.webPort}`; launchWebApp({ @@ -143,9 +146,6 @@ export async function runStart({ quiet: !showOutput, }); - const healthTimeoutMs = resolveHealthTimeoutMs(HEALTH_TIMEOUT_MS_RELEASE); - await waitForHealth(ports.backendUrl, backendProc, healthTimeoutMs); - // Print clean summary console.log(""); console.log("[kandev] Server started successfully"); diff --git a/apps/web/hooks/use-board-snapshot.ts b/apps/web/hooks/use-board-snapshot.ts index 701985725b..5547697ad5 100644 --- a/apps/web/hooks/use-board-snapshot.ts +++ b/apps/web/hooks/use-board-snapshot.ts @@ -1,10 +1,11 @@ import { useEffect } from 'react'; import { fetchBoardSnapshot } from '@/lib/api'; import { snapshotToState } from '@/lib/ssr/mapper'; -import { useAppStoreApi } from '@/components/state-provider'; +import { useAppStore, useAppStoreApi } from '@/components/state-provider'; export function useBoardSnapshot(boardId: string | null) { const store = useAppStoreApi(); + const connectionStatus = useAppStore((state) => state.connection.status); useEffect(() => { if (!boardId) return; @@ -13,7 +14,7 @@ export function useBoardSnapshot(boardId: string | null) { store.getState().hydrate(snapshotToState(snapshot)); }) .catch(() => { - // Ignore snapshot errors for now. + // Ignore snapshot errors — will retry on WS reconnect. }); - }, [boardId, store]); + }, [boardId, store, connectionStatus]); }