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

PaginationCursor update from dwn-sdk-js #15

Merged
merged 11 commits into from
Jan 23, 2024

Conversation

LiranCohen
Copy link
Member

@LiranCohen LiranCohen commented Jan 17, 2024

PaginationCursor is a new object in dwn-sdk-js.

It is comprised of a messageCid and a value. The value is of the sort property that you would like to continue your pagination from. The messageCid is used as a tiebreaker in the same way that query pagination already does.

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Merging #15 (6a6b470) into main (0f5f4ae) will increase coverage by 0.23%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #15      +/-   ##
==========================================
+ Coverage   80.41%   80.64%   +0.23%     
==========================================
  Files          10       10              
  Lines        1072     1080       +8     
  Branches      152      149       -3     
==========================================
+ Hits          862      871       +9     
+ Misses        210      209       -1     

@LiranCohen LiranCohen marked this pull request as ready for review January 19, 2024 04:28
Copy link
Collaborator

@amika-sq amika-sq left a comment

Choose a reason for hiding this comment

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

Just the one question. Otherwise LGTM!

Comment on lines 203 to 205
// currently the sort property is explicitly either `dateCreated` | `messageTimestamp` | `datePublished` which are all strings
// if it is not of type string we return an empty result set
const cursorValue = pagination.cursor.value as string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wanted to double check if this comment is still valid. I'm not immediately seeing an empty result set return if values isn't a string here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! I had some logic here but decided against it for now.
It's not a scenario that would really happen, and I'd like to add some DWN specific error to handle that case.

Created an issue and updated the comment to reflect.
TBD54566975/dwn-sdk-js#664

@LiranCohen LiranCohen merged commit 6721d02 into main Jan 23, 2024
4 checks passed
@LiranCohen LiranCohen deleted the lirancohen/pagination-cursor branch January 23, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants