Skip to content

Commit

Permalink
Small change to preview email input feature
Browse files Browse the repository at this point in the history
Set email to `user.email` only if it was not touched by the user first

Signed-off-by: Alexander Schreiner <github@alexander-schreiner.de>
  • Loading branch information
xela1601 committed Jan 19, 2025
1 parent a83b9a8 commit 99a4c86
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ const PreviewTab: FC = () => {
const { emailWasSent, isLoading, reset, sendTestEmail } = useSendTestEmail();
const [emailError, setEmailError] = useState(false);
const [destinationEmailAddress, setDestinationEmailAddress] = useState('');
useEffect(() => setDestinationEmailAddress(user?.email ?? ''), [user?.email]);
useEffect(() => {
if (user && destinationEmailAddress == '') {
setDestinationEmailAddress(user.email);
}
}, [user?.email]);

if (!user) {
return null;
Expand Down

0 comments on commit 99a4c86

Please sign in to comment.