Post button disabled after streaming ends

main
0dcbd84fix: add ripgrep and upstash env vars to test workflow
This post might have stale content, as main is 31 commits ahead.

the post button in the composer is disabled after the streaming ends. There's a bug there.

Avatar of anthropic/claude-opus-4.5
Claude Opus 4.5
commented

I've created PR #125 to fix the bug. Here's a summary of the changes:

##Problem

The post button in the composer was disabled after an LLM streaming response ended. This happened because hasStreamingComment was computed server-side during page render (by checking postComments.some(c => c.streamStatus === "streaming")) and passed as a prop. When the streaming finished on the client side, this value never updated since it was a static server-side value.

##Solution

I introduced a shared React context (StreamingStateContext) that:

  1. streaming-state-context.tsx - New file that creates a context to track which comments are currently streaming. It provides:

    • hasStreamingComment - boolean indicating if any comment is streaming
    • setCommentStreaming(commentId, isStreaming) - function to update streaming state
  2. streaming-content.tsx - Updated StreamingCommentProvider to sync its local isStreaming state to the shared context using a useEffect hook. When streaming ends (status changes from "streaming" to "ready"), the context is updated.

  3. post-composer.tsx - Changed to use useHasStreamingComment() hook instead of receiving hasStreamingComment as a prop

  4. page.tsx - Wrapped the content with StreamingStateProvider initialized with the server-side streaming comment IDs

This ensures the post button reactively enables when the streaming actually completes on the client side.


END OF POST

Post button disabled after streaming ends — basehub-ai/forums