fix(dashboard): planning mode question display + new-session reset

- Add 8s polling fallback while view is "loading" so a missed SSE
  question/summary event self-heals instead of leaving the panel stuck
  on "thinking" until close+reopen.
- Track dismissed resumeSessionIds in a ref and drop loadSession from
  the resume effect's deps so typing into the textarea no longer
  re-fires resume and yanks the user back to the previous session.
- Guard SSE onThinking/onQuestion/onSummary against late events from a
  torn-down connection by comparing the captured sessionId against
  currentSessionIdRef.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-01 11:40:48 -07:00
parent d63aef925a
commit f0d0f8ce29
2 changed files with 81 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
---
"@runfusion/fusion": patch
---
Fix two issues with question display in planning mode:
- Questions sometimes stayed hidden behind the "thinking" view until the panel was closed and reopened. The live SSE `question` event could be missed (e.g. when the tab was throttled), and the only path that promoted the view was the live event. Add an 8s polling fallback that refetches the session while the view is in the `loading` state and transitions to `question`/`summary` if the server has already moved on, so a dropped event self-heals.
- Clicking "New Session" and then typing into the textarea jumped the panel back to the previous session's questions. The "resume on open" effect listed `loadSession` in its deps; `loadSession` is recreated whenever `connectToPlanningStream` changes, and the latter depends on `initialPlan`, so each keystroke re-ran the resume effect and reloaded the dismissed session. Track dismissed `resumeSessionId`s in a ref and drop `loadSession` from the effect's deps. Also guard the SSE `onThinking`/`onQuestion`/`onSummary` handlers against late events from a stale connection so they can't overwrite the new session's view.