From 494adb9b533303851b1ce4b44c39fa342b9c9a86 Mon Sep 17 00:00:00 2001 From: Michael Richter Date: Tue, 1 Sep 2026 15:08:12 +0200 Subject: [PATCH] fix: set default addressbook to selected one --- components/contacts/contacts-app.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/contacts/contacts-app.tsx b/components/contacts/contacts-app.tsx index ff7292a0f..40a8ed326 100644 --- a/components/contacts/contacts-app.tsx +++ b/components/contacts/contacts-app.tsx @@ -391,6 +391,13 @@ export function ContactsApp({ linkSegments }: ContactsAppProps = {}) { const handleCreateNew = () => { setSelectedContact(null); + // When a specific address book is being viewed, create the new contact in + // that book instead of falling back to the account's default book. + if (typeof activeCategory === "object" && "addressBookId" in activeCategory) { + setDefaultBookIdForCreate(activeCategory.addressBookId); + } else { + setDefaultBookIdForCreate(undefined); + } setView("create"); }; @@ -961,7 +968,8 @@ export function ContactsApp({ linkSegments }: ContactsAppProps = {}) { } : undefined} onCreateContactInBook={(book) => { setDefaultBookIdForCreate(book.id); - handleCreateNew(); + setSelectedContact(null); + setView("create"); }} onDeleteAddressBook={client ? async (book) => { const ok = await confirmDialog({