acmutd / acmutd/leadership

[Feature] Update project to be statically built at compile time

Abierto
#46 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
TypeScript
Estrellas
3
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Describe new addition**
The entire project relies on data that does not change very often. Currently, the `getServerSideProps()` on all the pages that display information (the landing pages & the individual profile pages) take a couple of seconds to load which diminishes the user experience. It would be possible to use `getStaticProps()` or other strategies to make the entire project to be prebuilt and lead to much faster load times.

**Task List**
- [ ] Change all `getServerSideProps()` to a [static option](https://nextjs.org/docs/basic-features/data-fetching/get-static-props) instead
- [ ] Use [getStaticPaths()](https://nextjs.org/docs/basic-features/data-fetching/get-static-paths) to build all the profile pages for each officer, participant, team, etc
- [ ] Appropriately choose how to handle situations like `next-auth` session (either keep it in `getServerSideProps()` or use the React Hook option instead). Make any relevant changes to accommodate these refactors.
- [ ] Handle filters using an `useEffect` to maintain existing features

**Additional context**
For those wondering why the initial concept used `getServerSideProps()` it was to accommodate one very specific feature --> sharing URLs for filtered searches. For example when filtering for the list of all officers to find just people who used to be `President` the URL itself gets modified and becomes `https://leadership.acmutd.co/profile?q=President`. This URL can then be shared between different people to directly land on a view that consists of just people who hold that role. Since URL parameters only exist during runtime, it was easy to implement this via `getServerSideProps()`. It is possible to make this static as well but requires some additional code overhead.

**Optional Task List**

- [ ] Convert all filtering actions to be handled at build time statically
- [ ] At build time, create a function that will wipe out the cached copy of all the filters
- [ ] At build time, re-calculate all the cached values for each filter operation
- [ ] At build time, use `getStaticPaths()` to create the views for all filter operations to maintain existing functionality

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.