bigbluebutton / greenlight

A really simple end-user interface for your BigBlueButton server.
GNU Lesser General Public License v3.0
789 stars 3.8k forks source link

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

Closed nirajkumar999 closed 1 month ago

nirajkumar999 commented 1 month ago

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 commented 1 month ago

Also needs to be rebased please

nirajkumar999 commented 1 month ago

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

farhatahmad commented 1 month ago

Needs to be updated again please

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

nirajkumar999 commented 1 month ago

Updated @farhatahmad