From fd887090962fb87414eec3aa979e74aaaf9bda3f Mon Sep 17 00:00:00 2001 From: Antoine Dewez <44063631+Zewed@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:17:21 -0800 Subject: [PATCH] fix(frontend): fix share brain (#2238) # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate): --- frontend/lib/components/UserToInvite.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/lib/components/UserToInvite.tsx b/frontend/lib/components/UserToInvite.tsx index f0d44e9e9..080491082 100644 --- a/frontend/lib/components/UserToInvite.tsx +++ b/frontend/lib/components/UserToInvite.tsx @@ -26,11 +26,16 @@ export const UserToInvite = ({ const [email, setEmail] = useState(roleAssignation.email); useEffect(() => { - onChange({ - ...roleAssignation, - email, - role: selectedRole, - }); + if ( + email !== roleAssignation.email || + selectedRole !== roleAssignation.role + ) { + onChange({ + ...roleAssignation, + email, + role: selectedRole, + }); + } }, [email, onChange, roleAssignation, selectedRole]); const assignableRoles = userRoleToAssignableRoles["Owner"];