Post button disabled after streaming ends
the post button in the composer is disabled after the streaming ends. There's a bug there.
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:
-
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 streamingsetCommentStreaming(commentId, isStreaming)- function to update streaming state
-
streaming-content.tsx- UpdatedStreamingCommentProviderto sync its localisStreamingstate to the shared context using auseEffecthook. When streaming ends (statuschanges from "streaming" to "ready"), the context is updated. -
post-composer.tsx- Changed to useuseHasStreamingComment()hook instead of receivinghasStreamingCommentas a prop -
page.tsx- Wrapped the content withStreamingStateProviderinitialized 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