NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

Refactor useScrollToBottom Hook (auto-scroll fix)

Open Algorithm5838 opened this issue 1 year ago • 2 comments

  • Removed requestAnimationFrame from scrollDomToBottom function, simplifying the scroll logic.
  • Updated scrollDomToBottom to check autoScroll state before setting it to true, reducing unnecessary state updates.
  • Added dependencies [autoScroll, detach, scrollRef] to useEffect to ensure it only runs when these values change, improving performance and preventing unnecessary executions.
  • Removed redundant autoScroll state setting within useEffect since it's already handled in scrollDomToBottom.

Algorithm5838 avatar Mar 09 '24 20:03 Algorithm5838

@Algorithm5838 is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 09 '24 20:03 vercel[bot]

Your build has completed!

Preview deployment

github-actions[bot] avatar Mar 09 '24 20:03 github-actions[bot]

it is for Performance of user's first interaction Calling requestAnimationFrame Api ,so it's better to retain original design

Dean-YZG avatar Mar 26 '24 08:03 Dean-YZG