dotkom / onlineweb-frontend

Next generation frontend for onlineweb
https://online.ntnu.no
23 stars 9 forks source link

minimize requests to backend from frontend on event page DOT-262 #696

Open henrikskog opened 11 months ago

henrikskog commented 11 months ago

The queries made to the backend from online.ntnu.no/events/{event} are expensive. To avoid that the backend crashes on big events, we want to be smart about how many requests we send from the frontend.

Measures

Double fetching bug Prev behaviour: User goes to the event detail page. Event/attendance event data is fetched from backend. This is done in a useEffect with userLoggedIn as dep. This causes useEffect to be ran twice, as isLoggedIn goes from false on init to true.

Now: event data is fetched from the backend once independent of user being logged in or not. For the user, there is no difference as to before.

Caching backend response when fresh content is not needed

vercel[bot] commented 11 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onlineweb-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2023 3:35pm
github-advanced-security[bot] commented 11 months ago

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

linear[bot] commented 11 months ago
DOT-262 Prepare for Åre and Julebord attendance opening

[image.png](https://uploads.linear.app/f2f2782a-dee3-414e-b6f1-cda51c6aa30b/6bcf3fb8-0b1c-48e6-97a5-55dcda38cefa/c2490845-03c7-4b36-a0b8-ff61ea6d3246) Julebord is opening for attendance: 4th of november Åre is opening for attendance: TBD * Åre 2022 had påmeldingsstart 2. november * Åre 2023 had påmeldingsstart 15. november * We **NEED** to either solve ow crashing on big events like these are going to be, or come up with a different solution.

sonarcloud[bot] commented 11 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication