Merge pull request 'fix(canvas/mobile): remove ?? [] from Zustand selector to prevent infinite render loop' (#662) from fix/canvas-mobile-chat-loop into main
Some checks failed
Block internal-flavored paths / Block forbidden paths (push) Successful in 17s
Harness Replays / detect-changes (push) Successful in 20s
CI / Detect changes (push) Successful in 45s
publish-canvas-image / Build & push canvas image (push) Failing after 37s
E2E Staging Canvas (Playwright) / detect-changes (push) Successful in 52s
Secret scan / Scan diff for credential-shaped strings (push) Successful in 16s
E2E API Smoke Test / detect-changes (push) Successful in 55s
Handlers Postgres Integration / detect-changes (push) Successful in 51s
Harness Replays / Harness Replays (push) Successful in 9s
CI / Platform (Go) (push) Successful in 9s
CI / Shellcheck (E2E scripts) (push) Successful in 6s
CI / Python Lint & Test (push) Successful in 9s
E2E API Smoke Test / E2E API Smoke Test (push) Successful in 11s
Runtime PR-Built Compatibility / detect-changes (push) Successful in 43s
Handlers Postgres Integration / Handlers Postgres Integration (push) Successful in 9s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (push) Successful in 8s
Sweep stale AWS Secrets Manager secrets / Sweep AWS Secrets Manager (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
publish-workspace-server-image / build-and-push (push) Successful in 6m18s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (push) Successful in 7m28s
CI / Canvas (Next.js) (push) Successful in 8m11s
CI / Canvas Deploy Reminder (push) Successful in 2s
CI / all-required (push) Successful in 1s
Staging SaaS smoke (every 30 min) / Staging SaaS smoke (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Sweep stale e2e-* orgs (staging) / Sweep e2e orgs (push) Successful in 6s
Sweep stale Cloudflare Tunnels / Sweep CF tunnels (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
Continuous synthetic E2E (staging) / Synthetic E2E against staging (push) Compensated by status-reaper (workflow has no push: trigger; Gitea 1.22.6 hardcoded-suffix bug — see .gitea/scripts/status-reaper.py)
status-reaper / reap (push) Successful in 1m22s

This commit is contained in:
Molecule AI · core-uiux 2026-05-12 05:26:02 +00:00
commit 18a32e1ad4

View File

@ -54,9 +54,14 @@ export function MobileChat({
// user sees their prior thread on entry. The store is updated by the
// socket → ChatTab flows the desktop runs; on mobile we read from the
// same buffer to keep state coherent across viewports.
const storedMessages = useCanvasStore((s) => s.agentMessages[agentId] ?? []);
// NOTE: do NOT use `?? []` in the selector — Zustand uses Object.is
// for selector equality. A fallback `?? []` creates a new [] reference on
// every store update when agentMessages[agentId] is undefined, causing an
// infinite re-render loop (React error #185 / Maximum update depth
// exceeded). The undefined case is handled by the initializer below.
const storedMessages = useCanvasStore((s) => s.agentMessages[agentId]);
const [messages, setMessages] = useState<ChatMessage[]>(() =>
storedMessages.map((m) => ({
(storedMessages ?? []).map((m) => ({
id: m.id,
role: "agent",
text: m.content,