vercel / ai-chatbot

A full-featured, hackable Next.js AI chatbot built by Vercel
https://chat.vercel.ai
Other
5.53k stars 1.63k forks source link

useEffect with no dependency array #299

Open amithmkini opened 3 months ago

amithmkini commented 3 months ago

Is there any reason why we need to set the id for every state update in the Chat component? I understand setting the id on component mount, but doesn't make sense to run it for every re-render.

https://github.com/vercel/ai-chatbot/blob/fa9f0947f0a7983cf5022cbbc1416910349dd5e4/components/chat.tsx#L47-L49

athrael-soju commented 3 months ago

That's a good find @amithmkini. I'd also like to see a response on this. But, there hasn't been much activity on this template from Vercel lately.