Merge pull request #941 from ponchofiesta/bugfix/940-create-contact-in-selected-addressbook

fix: set default addressbook to selected one
This commit is contained in:
Linus Rath
2026-09-01 20:17:31 +02:00
committed by GitHub
+9 -1
View File
@@ -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({