feat: compute cursor for each result #277
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes Made
Potential Risks
Not fully understanding all the uses of the paginatedField, I just isolated and exctracted the cursor creation logic from existing code I found on this library. If something I didn't predict is passed in the
paginatedField
value, the cursor validity would be compromised. The good thing is that the new centralized approach handles the cursor logic isolatedly so this event would be easier to spot and fix.Test Plan
includeCursor
parameter, the response should include a_cursor
property for each document, containing the document cursor.previous
result property.next
result property.previous
andnext
results should benull
.Checklist