upstash / degree-guru

AI chatbot for expert answers on university degrees
https://degreeguru.vercel.app/
119 stars 32 forks source link

fix: optimize form submission with useCallback and fix additional overflow-y property #8

Closed onurhan1337 closed 3 months ago

onurhan1337 commented 3 months ago

This PR introduces two changes to the Home component:

  1. The form submission event handler is now optimized using the useCallback hook. Previously, the onSubmit function was defined directly inside the Form component as an anonymous function, leading to the function being redefined on every render. This could potentially cause unnecessary re-renders and decreased performance. Now, the onSubmit function is memoized using useCallback, and is only redefined when handleSubmit changes. This can lead to performance improvements as unnecessary re-renders are avoided.

  2. The overflow-y CSS property in the main element has been changed from scroll to auto. This means that the scrollbar will now only appear when the content overflows, instead of always being visible.

Please review the changes and let me know if there are any concerns.

before/after change overflow-y-scroll to overflow-y-auto:

vercel[bot] commented 3 months ago

@onurhan1337 is attempting to deploy a commit to the Upstash Team on Vercel.

A member of the Team first needs to authorize it.

ademilter commented 3 months ago

@onurhan1337 thank you for your contribution