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

[Backend] Add Throttling to Buttons Throughout the App #56

Open
johnny-t06 opened this issue Jan 17, 2025 · 0 comments · May be fixed by #59
Open

[Backend] Add Throttling to Buttons Throughout the App #56

johnny-t06 opened this issue Jan 17, 2025 · 0 comments · May be fixed by #59
Assignees
Labels

Comments

@johnny-t06
Copy link
Collaborator

Description

Currently when someone signs up for an account, they can spam the button which accumulates api calls to our backend and makes a lot of user accounts in our database. This is bad behavior. The user should only be able to press the button once and/or make one api call with the sign up form before the form is cleared. This is not isolated to just the sign up form. Imagine that an Admin could delete users. If someone spams that button, only the first deletion would be successful while the other calls would result in errors – which could affect our frontend and backend if not handled correctly.

We want you to explore the world of api throttling with a custom React hook https://react.dev/reference/react/hooks. It's okay if you’re not familiar with hooks, we’re here to help.

Pointers

This is a challenging ticket so here’s a few pointers:

  • The hook should take in / wrap a function call.
  • It should differentiate between a “first” api call and any subsequent calls.
  • Managing a state for when an api call is happening so we can display something in the frontend (i.e a Spinner, or disable the button)

Testing

Once you made a throttling hook, try to add it to our existing buttons and see if it works!

@wkim10 wkim10 added the backend label Jan 17, 2025
@tomasmaranga tomasmaranga linked a pull request Jan 27, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants