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

Refactored LinksForm.jsx component to improve performance and avoid unnecessary API calls #5891

Merged

Conversation

rautniraj
Copy link
Contributor

In continuation to my PR #5887, as discussed in my Seventh Improvement point, we can extend the performance optimization by preventing unnecessary onSubmit of Form in case of tnc, privacy policy and help center fields. So PATCH request will only be sent if there is actual change in the value.

I have introduced a useRef variable formText which initially stores the actual value of these fields and further tracks any changes to the value.

In handleSubmit function we call mutation only when this formText variable shows any changes. Hence this way we prevent any unnecessary PATCH request when user continuously clicks the Change URL function.

@farhatahmad
Copy link
Collaborator

Also needs to be rebased please

@rautniraj rautniraj force-pushed the fixes-to-LinksForm.jsx-component branch from fe9f93e to 6a5ac4d Compare July 28, 2024 12:11
…n button click.

We can extend the performance optimization by preventing unnecessary onSubmit of Form in case of tnc, privacy policy and help center fields. So PATCH request will only be sent if there is actual change in the value.

I have introduced a useRef variable formText which initially stores the actual value of these fields and further tracks any changes to the value.

In handleSubmit function we call mutation only when this formText variable shows any changes. Hence this way we prevent any unnecessary PATCH request when user continuously clicks the Change URL function.
@rautniraj rautniraj force-pushed the fixes-to-LinksForm.jsx-component branch from 6a5ac4d to 3b3c9ee Compare July 28, 2024 14:16
@rautniraj
Copy link
Contributor Author

Rebased and updated my commit message to include details for the changes done in code @farhatahmad

@farhatahmad
Copy link
Collaborator

Needs to be updated again please

Copy link

sonarqubecloud bot commented Aug 1, 2024

@rautniraj
Copy link
Contributor Author

rautniraj commented Aug 1, 2024

Updated @farhatahmad

@farhatahmad farhatahmad merged commit 244bd2a into bigbluebutton:master Aug 6, 2024
3 checks passed
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.

2 participants