Open ashersamuel8 opened 3 months ago
^ Experiencing the same issue where the component remounts again and causes a major flicker and layout shift in the AI generated text.
Try to see if you can downgrade to ai@3.2.5
and see if there flicker disappears?
Description
I'm using
ai/rsc
for my application and there seems to be an issue withstreamUI()
. I am usingstreamUI()
in function (server actions function) calledsubmitUserMessage(...)
. The function returns theresult.value
(the UI component to be streamed) AGAIN after the stream is closed/streamUI()
is done executing (check the example below). To dig deeper, I wrote the same function usingstreamText()
, inside which I usedcreateStreamableUI()
to stream the UI component. What I noticed is that when I close the stream ofcreateStreamableUI()
using.done()
, the UI component, for some reason, is returned again, leading to other undesirable behavior like component remounting, layout shifts, and animation restarts on the client side. Is there a way to fix/work around this? I don't notice the same behavior when I close the stream withcreateStreambleValue()
.It is also worth noting that my function and UI components work as desired when I don't close
createStreableUI()
using.done()
. However, it throws an error in production environment since the connection isn't closed.Code example
Code using
streamUI()
:Code using
streamText()
without closing thecreateStrarmableUI()
stream (works as expected on localhost but throws errors in production because the stream isn't closed:Additional context
What I'm using