Skip to content

fix: avoid fetching the user's addressbooks per component instance#4794

Draft
kesselb wants to merge 2 commits intomainfrom
bug/noid/contact-details-singleton
Draft

fix: avoid fetching the user's addressbooks per component instance#4794
kesselb wants to merge 2 commits intomainfrom
bug/noid/contact-details-singleton

Conversation

@kesselb
Copy link
Copy Markdown
Contributor

@kesselb kesselb commented Oct 14, 2025

How to test:

Before: You should see one request for each recipient to PROPFIND /remote.php/dav/principals/users/alice/ and PROPFIND /remote.php/dav/addressbooks/users/alice/

After: You should see only one request to PROPFIND /remote.php/dav/principals/users/alice/ and PROPFIND /remote.php/dav/addressbooks/users/alice/

@kesselb kesselb self-assigned this Oct 14, 2025
@kesselb kesselb added bug Something isn't working 3. to review Waiting for reviews labels Oct 14, 2025
}

this.promise = (async () => {
await client.connect({ enableCardDAV: true })
Copy link
Copy Markdown
Contributor Author

@kesselb kesselb Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn’t exactly what Richard suggested, but I dropped that approach because I couldn’t get it to work. In hindsight, I think the idea itself was fine, but I realized too late that the Vuex store was already shared between components, while the Pinia instances were not. Since I created a new Pinia store for it, that was probably the issue I was running into.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/views/ReadOnlyContactDetails.vue 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

return context.getters.getAddressbooks
}

context.state.addressbooksFetched = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shared pinia store + this should do the trick, right? The promise hack seems superfluous

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid not. The shared pinia store is the requirement to make the promise hack work 🙈

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to revert this line as it's actually unrelated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. I was pretty sure that moving the flag toggle up could solve the issue elegantly. The first call of the action actually fetches addressbooks the other ones return early. This is fine if the result of the action is not used but address books populate reactively once loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants