How to memoize messages properly when using "useChat" #4066
Unanswered
LaurinBrechter
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I am using
useChat
and then rendering the messages in the ui as in the example below, all messages get rerendered whenever a single chunk is being streamed back to the client. This can be very costly when rendering the messages is expensive. Are there any examples of how to properly memoize 'old' messages? I have something working where I put past messages into a different state that doesn't get rerendered on every chunk from the response but I was wondering if anyone else was having this problem when simply rendering themessages
arrayBeta Was this translation helpful? Give feedback.
All reactions