Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Code Review
This pull request improves the ChunksDialog component by using a ref to track the current page, preventing manual navigation from being reset during live updates. It also updates the Anthropic inbound stream logic to ensure a signature is always provided for thinking blocks, generating a random placeholder if necessary and concatenating multiple signature chunks. Feedback was provided regarding the auto-scroll logic in the ChunksDialog, specifically that jumping to the last page when the user is on the first page might disrupt the user experience.
| const newTotalPages = Math.ceil(chunks.length / pageSize); | ||
| if (chunksPage >= totalChunksPages || chunksPage === 1) { | ||
| // totalChunksPages is already re-computed in this render (depends on chunks.length + pageSize) | ||
| if (chunksPageRef.current >= totalChunksPages || chunksPageRef.current === 1) { |
There was a problem hiding this comment.
The condition chunksPageRef.current === 1 in the auto-scroll logic causes the view to jump to the last page whenever a new chunk arrives, even if the user is intentionally viewing the first page. This disrupts the user experience when reading from the beginning of a live stream. Consider removing this condition to ensure that auto-scroll only triggers when the user is already at the end of the list.
| if (chunksPageRef.current >= totalChunksPages || chunksPageRef.current === 1) { | |
| if (chunksPageRef.current >= totalChunksPages) { |
Uh oh!
There was an error while loading. Please reload this page.