Skip to content

Commit

Permalink
ui: forms - fix email bug in arrays
Browse files Browse the repository at this point in the history
Signed-off-by: pamfilos <pamfilosf@gmail.com>
  • Loading branch information
pamfilos committed Oct 19, 2023
1 parent cd5515b commit a068c10
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const NormalArrayFieldTemplate = ({
const [emailModal, setEmailModal] = useState(false);
const [selectedEmailList, setSelectedEmailList] = useState(
uiSchema["ui:options"] && uiSchema["ui:options"].email
? formData.map(user => user.profile.email)
? formData.map(user => user?.profile?.email)
: []
);
const [copy, setCopy] = useState(false);
Expand Down Expand Up @@ -148,12 +148,12 @@ const NormalArrayFieldTemplate = ({
const updateEmailSelectedListAll = () => {
formData.length === selectedEmailList.length
? setSelectedEmailList([])
: setSelectedEmailList(formData.map(user => user.profile.email));
: setSelectedEmailList(formData.map(user => user?.profile?.email));
};

useEffect(() => {
if (emailModal && formData.length != selectedEmailList.length)
setSelectedEmailList(formData.map(user => user.profile.email));
setSelectedEmailList(formData.map(user => user?.profile?.email));
}, [emailModal]);

return (
Expand Down

0 comments on commit a068c10

Please sign in to comment.