Dogusata/fix update chat answer with message id not working #50
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.
Problem
To update a chat card, if it is/was the latest streaming card, it can be updated with
updateLastChatItem
method. For all other casesupdateChatItemWithMessageId
should work. However, if there is no streaming card at all in the whole window, cards are not getting updated with both of the functions.Expected Behaviour:
Doesn't matter what type is the chat item and it is the last of not, it has to be updated with
updateChatItemWithMessageId
if the chat item with the given messageId is rendered already.Steps to Reproduce:
Create a card by adding a new ChatItem with type
ANSWER
without providing thebody
attribute. After that try to update it with any of the mentioned methods above.Solution
The checks for adding a card render to the rendered items list was insufficient. Any card (if they are rendered) should be added to the rendered items list to allow them to be updated. Previously the UX decision was to not update the cards after they finish the streaming. However for cases like WeaverBird's file rejection and reverting rejects, previous cards should also allow updating.
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.