fix: allow clearing optional SMTP and email template sender fields#3051
fix: allow clearing optional SMTP and email template sender fields#3051HarshMN2345 wants to merge 3 commits into
Conversation
Optional fields (senderEmail, replyToEmail, senderName, replyToName,
username, password) could not be cleared once set. The frontend used
|| undefined which silently dropped empty strings, so the backend
never received "" and the old value persisted on reload.
smtp/+page.svelte:
- Use ?? undefined instead of || undefined so empty strings are sent
- Fix isButtonDisabled deepEqual comparison: normalize types on both
sides (?? '' for strings, ?? null for port, normalizeSecure() for
secure) to avoid false positives from null/undefined mismatches
- Derive project from data.project so it stays reactive after
invalidate() — fixes button not disabling after save without reload
- Remove second $effect that cleared fields on disable, which fought
the first effect and kept the button permanently enabled
emailTemplate.svelte:
- Use ?? undefined instead of || undefined for sender/reply fields
- Add disabled={!isSmtpEnabled} to replyToEmail and replyToName,
matching the existing behaviour of senderName and senderEmail
Greptile SummaryThis PR fixes two related bugs: optional SMTP and email-template fields (senderEmail, replyToEmail, senderName, replyToName, username, password) could not be cleared once set because
Confidence Score: 5/5Safe to merge — the core logic changes are correct and well-scoped fixes for the described clearing and button-state bugs. All changes are targeted bug fixes: the The new Important Files Changed
Reviews (3): Last reviewed commit: "feat: add reset to default button on ema..." | Re-trigger Greptile |
…/emailTemplate.svelte Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Optional fields (senderEmail, replyToEmail, senderName, replyToName, username, password) could not be cleared once set. The frontend used || undefined which silently dropped empty strings, so the backend never received "" and the old value persisted on reload.
smtp/+page.svelte:
emailTemplate.svelte:
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)