Skip to content

Comments

feat: add pagination compatibility to cardav backend#47909

Draft
hamza221 wants to merge 1 commit intomasterfrom
feat/pagination-cardav
Draft

feat: add pagination compatibility to cardav backend#47909
hamza221 wants to merge 1 commit intomasterfrom
feat/pagination-cardav

Conversation

@hamza221
Copy link
Contributor

@hamza221 hamza221 commented Sep 11, 2024

Summary

TODO

  • ...

Checklist

Signed-off-by: Hamza Mahjoubi <hamzamahjoubi221@gmail.com>
@hamza221 hamza221 added enhancement 2. developing Work in progress feature: carddav Related to CardDAV internals labels Sep 11, 2024
@hamza221 hamza221 requested a review from st3iny September 11, 2024 20:15
@hamza221 hamza221 self-assigned this Sep 11, 2024
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
$offset = $_SERVER['HTTP_X_NEXTCLOUD_OFFSET'];
$limit = $_SERVER['HTTP_X_NEXTCLOUD_LIMIT'];
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id'], $offset, $limit);

Check failure

Code scanning / Psalm

InvalidArgument

Argument 2 of OCA\DAV\CardDAV\CardDavBackend::getCards expects int|null, but string provided
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
$offset = $_SERVER['HTTP_X_NEXTCLOUD_OFFSET'];
$limit = $_SERVER['HTTP_X_NEXTCLOUD_LIMIT'];
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id'], $offset, $limit);

Check failure

Code scanning / Psalm

InvalidArgument

Argument 3 of OCA\DAV\CardDAV\CardDavBackend::getCards expects int|null, but string provided
@ChristophWurst ChristophWurst marked this pull request as draft September 12, 2024 07:27
@ChristophWurst
Copy link
Member

I'd prefer a cursor based pagination if possible

https://medium.com/@maryam-bit/offset-vs-cursor-based-pagination-choosing-the-best-approach-2e93702a118b

It's better for performance and more robust when the address book changes while the Contacts app is open

public function getChildren() {
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
$offset = $_SERVER['HTTP_X_NEXTCLOUD_OFFSET'];
$limit = $_SERVER['HTTP_X_NEXTCLOUD_LIMIT'];
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to use the standardized limit: https://datatracker.ietf.org/doc/html/rfc6352#section-8.6.1

@miaulalala miaulalala removed their request for review November 14, 2024 20:22
@skjnldsv skjnldsv added this to the Nextcloud 32 milestone Jan 30, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
@blizzz blizzz modified the milestones: Nextcloud 33, Nextcloud 34 Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress enhancement feature: carddav Related to CardDAV internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants