Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pagination compatibility to cardav backend #47909

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hamza221
Copy link
Contributor

@hamza221 hamza221 commented Sep 11, 2024

Summary

TODO

  • ...

Checklist

@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 Error

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 Error

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

@@ -157,7 +157,9 @@ public function getChild($name) {
}

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
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.

2 participants