Fix MAIL-ADDR-PERSIST: Persist USPS-corrected address back to contact#164
Open
bmoss2015 wants to merge 1 commit into
Open
Fix MAIL-ADDR-PERSIST: Persist USPS-corrected address back to contact#164bmoss2015 wants to merge 1 commit into
bmoss2015 wants to merge 1 commit into
Conversation
After the operator clicks "Use Corrected Version" in Send Mail, the Lob-suggested address now writes back to contacts.value via a new persistContactAddress server action, so the next time the same recipient shows up in Send Mail the corrected address loads in place of the original. Previously the correction lived only in the modal's local addressOverrides state and was thrown away on close, so every send to the same person re-asked for the correction. The action serializes the address through formatAddressForStorage() to the canonical "line1, city, ST ZIP" form. The existing BEFORE UPDATE trigger on public.contacts (migration 0133) clears the address_verify_* cache fields automatically when contacts.value changes, so the next verifyAddressAction call computes against the fresh address. After persisting, we re-run verifyAddressAction with the contact_id and force: true so the cache repopulates with the fresh result in one round trip.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
addressOverridesstate. On the next send to the same recipient, the contact still held the original undeliverable address and the fix panel re-appeared.persistContactAddressserver action insrc/app/(app)/mail/_verify-action.tsrewritescontacts.valuewith the canonical "line1, city, ST ZIP" form viaformatAddressForStorage().SendMailModal.applyAddressSuggestion()now callspersistContactAddressbefore re-running verify, and the re-run passescontact_id+force: trueso the verify cache repopulates against the fresh value in one round trip.public.contacts(migration 0133) clears theaddress_verify_*cache fields automatically when value changes, so the cache lookup on the next send won't return a stale hit.Test plan
Preview creds: info@mossyland.com / MossEquity-858dc58d33!