Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

henrikskog
Copy link
Contributor

@henrikskog henrikskog commented Oct 1, 2023

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

prev behaviour: fetch event and attendance event from backend in useeffect with userLoggedIn as dep. This causes fetching being done two times, even though user logged in is not relevant.
@vercel
Copy link

vercel bot commented Oct 1, 2023

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
Copy link

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.

@henrikskog henrikskog changed the title fix fetching bug fix fetching bug DOT-262 Oct 1, 2023
@linear
Copy link

linear bot commented Oct 1, 2023

DOT-262 Prepare for Åre and Julebord attendance opening

image.png

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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 1, 2023

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

@henrikskog henrikskog changed the title fix fetching bug DOT-262 minimize requests to backend from frontend on event page DOT-262 Oct 1, 2023
@henrikskog henrikskog marked this pull request as draft October 1, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant