user-story
user-story copied to clipboard
Fixed infinite api calls in a story
Issue Number
fixes #105
Describe the changes you've made
I have added the React useEffect hook in the commentForm component where all the users of the application are fetched. Previously, without the hook, the state was updated at each call, and this caused the component to re-render for every call. This led to infinite API calls to the backend. After this fix a request is made to the backend only once which is sufficient to fetch all the users.
Describe if there is any unusual behavior (Any Warning) of your code(Write NA if there isn't)
NA
Additional context (OPTIONAL)
NA
Test plan (OPTIONAL)
A good test plan should give instructions that someone else can easily follow.
NA
Checklist
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] All new and existing tests passed.
- [x] The title of my pull request is a short description of the requested changes.
Provide a Deployed link of route/page that needs to review
Preview: Deploy preview link here with the appropriate route
NA
@kbhutani0001 @mharshita This PR can be closed since the issue has been tackled in PR 117