Skip to content

fix(contacts): edit contact creates duplicate [PERA-3989]#371

Merged
yasin-ce merged 3 commits intomainfrom
contacts/01-fix-edit-duplicate
Apr 25, 2026
Merged

fix(contacts): edit contact creates duplicate [PERA-3989]#371
yasin-ce merged 3 commits intomainfrom
contacts/01-fix-edit-duplicate

Conversation

@yasin-ce
Copy link
Copy Markdown
Collaborator

@yasin-ce yasin-ce commented Apr 24, 2026

Description

  • Switch `saveContact` from insert-only to a functional-update upsert keyed on `id`, so editing a contact no longer creates a second row.
  • Simplify `deleteContact` and drop the unused `setContacts` action.
  • Make `id` and `image` optional in the schema so edited contacts round-trip through validation.

Related Issues

Checklist

  • Have you tested your changes locally?
  • Have you reviewed the code for any potential issues?
  • Have you documented any necessary changes in the project's documentation?
  • Have you added any necessary tests for your changes?
  • Have you updated any relevant dependencies?

Additional Notes

Bottom of a 7-PR stack (base: `main`). Every downstream PR (#372#377) depends on this store behavior — please land this first.

- saveContact: insert-only → upsert (functional set).
- Schema: id and image optional so edits round-trip the id.
- deleteContact: simplified; setContacts removed (unused).
@yasin-ce yasin-ce requested review from fmsouza, wjbeau and yasincaliskan and removed request for wjbeau April 24, 2026 02:52
@yasin-ce yasin-ce self-assigned this Apr 24, 2026
@yasin-ce yasin-ce marked this pull request as ready for review April 24, 2026 03:04
… review

Instead of the UI hooks calling findContacts to guard against duplicate
addresses, saveContact now enforces uniqueness at the store layer and
throws DuplicateAddressError on conflict. Downstream hooks catch and
surface to form state.

Addresses PR #373 review comment to keep business rules in the package,
not the UI layer.
@yasin-ce yasin-ce merged commit 4a2d69c into main Apr 25, 2026
7 of 8 checks passed
@yasin-ce yasin-ce deleted the contacts/01-fix-edit-duplicate branch April 25, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants