feat: add session status store with optimistic active state and SSE polling (#272)

* feat: add session status store with optimistic active state and SSE polling

- Adds sessionStatusStore with setOptimisticActive (auto-timeout), statusCache deduplication, and replaceStatuses/clearStatus

- Integrates store in useSendPrompt (set optimistic on send, clear on error)

- Adds session.status SSE event handling in useSSE with 5s polling fallback

- Refactors test to mock the store instead of using real store instance

- Fixes repoId null check in useRepoActivity

* feat: replace event-source-polyfill with native SSE for PromptInput

* fix: keep stop button visible and hide clear prompt button during active session

* feat: restore failed queued prompts and preserve optimistic active status during poll

* test: add MessageThread tests for optimistic editing state and resend flow

* fix: handle queued prompt edge cases during pending submission and SSE errors
This commit is contained in:
Chris Scott authored and GitHub committed 2026-06-10 08:35:19 -04:00
1 parent 931f1215e6
commit 4e32fd5b00
16 files changed
+833 -61

No files matched your search

@@ -88,7 +88,6 @@ export const EditableUserMessage = memo(function EditableUserMessage({
onChange={(e) => setEditedContent(e.target.value)}
onKeyDown={handleKeyDown}
onFocus={() => setIsEditingMessage(true)}
onBlur={() => setIsEditingMessage(false)}
className="w-full p-3 rounded-lg bg-background border border-primary/50 focus:border-primary focus:ring-1 focus:ring-primary outline-none resize-none min-h-[60px] text-[16px] md:text-sm"
placeholder="Edit your message..."
disabled={refreshMessage.isPending}
@@ -158,4 +157,4 @@ export const ClickableUserMessage = memo(function ClickableUserMessage({
<Pencil className={`w-4 h-4 flex-shrink-0 mt-0.5 text-muted-foreground transition-all ${isMobile ? 'opacity-100' : 'opacity-50 group-hover/edit:opacity-100 group-hover/edit:text-primary'}`} />
</button>
)
})
})