NextChat
NextChat copied to clipboard
Refactor useScrollToBottom Hook (auto-scroll fix)
- Removed
requestAnimationFramefromscrollDomToBottomfunction, simplifying the scroll logic. - Updated
scrollDomToBottomto checkautoScrollstate before setting it totrue, reducing unnecessary state updates. - Added dependencies
[autoScroll, detach, scrollRef]touseEffectto ensure it only runs when these values change, improving performance and preventing unnecessary executions. - Removed redundant
autoScrollstate setting withinuseEffectsince it's already handled inscrollDomToBottom.
@Algorithm5838 is attempting to deploy a commit to the NextChat Team on Vercel.
A member of the Team first needs to authorize it.
it is for Performance of user's first interaction Calling requestAnimationFrame Api ,so it's better to retain original design