fix(ai): Set status to ready when reconnect stream is null #7685
+6
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
In the resume-stream flow, an active stream may not exist. In this case, the server returns 204 and the client should move on. However, prior to this fix, the useChat status would remain as "submitted" instead of being reset to "ready".
Summary
This commit addresses the issue by setting status to "ready" before returning early in the makeRequest function.
Verification
To reproduce the issue, call
resumeStream
when there is no active stream. Make sure your server is returning 204 in this case. If you log thestatus
returned fromuseChat
, you can see that it stays assubmitted
. It never gets reset back toready
.With this fix in place, the logs showed
status
being reset toready
after receiving the 204 from the server.Tasks
pnpm changeset
in the project root)pnpm prettier-fix
in the project root)