Nucleo-Estudantes-Informatica-ISEP / antirecurso

Wanna pass your exams? We gotcha! 😉
https://antirecurso.nei-isep.org
GNU General Public License v3.0
11 stars 7 forks source link

Avoid unnecessary re-renders #46

Open tomasflopes opened 1 year ago

tomasflopes commented 1 year ago

Not a specifying issue at all, but in many areas of the project the frontend is making many more requests that the ones that are needed. Some to next routes, other to our backend.

In some cases, the issues lie in some useEffect being called unnecessarily in a client component, in others, the issue has to be with the undiscriminated usage of the cache: 'no-store' in almost all fetch's made by the app.

Addressing these concerns could immensely enhance the project's performance. By thoroughly analyzing the codebase, we can identify opportunities to eliminate redundant re-renders. Using React mechanisms such as useCallback and useMemo would prove beneficial, as would reevaluating the overall approach taken during the development of the current version.

Server components could be optimized by using Next.js features like server-side rendering (SSR) and static site generation (SSG). Incorporating these techniques selectively (as excessive reliance may impede real-time data fetching when necessary) would greatly enhance the user experience and reduce waiting/painting times.

Explore the revalidation and cache options in the queries that are made and try to find a balance that fits the purpose of each one.