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

WIP - Cursor API #1301

Closed
wants to merge 5 commits into from
Closed

WIP - Cursor API #1301

wants to merge 5 commits into from

Conversation

Benaiah
Copy link
Contributor

@Benaiah Benaiah commented Apr 20, 2018

Summary

Implements a new cursor API that allows backends to implement pagination of folder-based collections for listing and search, without changing the code or behavior of existing backends (except test-repo, which has been modified to use the cursor API).

Moves the code that bypasses backend methods when integrations are present for search and entries listing to backend.js. Now the only part of the integrations API exposed to code outside of backend.js is the media library.

Adds pagination UI - infinite scroll as used by the existing pagination system (only used for the Algolia integration) is still possible, but not yet implemented for cursor-based backends due to debugging and performance reasons (we need a solid method of avoiding having thousands of React components in the entries list if you scroll through the whole collection, and it's not immediately clear how last or first would be implemented. (Note: the current infinite scroll UI doesn't work, as I still need to improve the UI code to detect when it needs to use the cursor function props or the old onLoadMore prop - this will be fixed before merge.)

Todo before merge:

  • See if listAllEntries performance can be improved by improving caching or allowing backends to implement it specifically and using different request strategies when listing everything as opposed to a single page.
  • Move Algolia integration to cursors and remove old pagination code, making all pagination use the same functions. (The UI issue described above will be solved by this.)
  • Write tests for cursor API to ensure functionality hasn't regressed.

Test plan

The test-repo backend has been modified to use cursors, as well as the GitLab PR (the PR hasn't yet been updated, but the branch implementing GitLab with cursors is at https://github.com/netlify/netlify-cms/tree/gitlab-benaiah-rebased-onto-cursor-api. Manual testing has been done on both of those, and some automated Redux tests will follow. (The planned development of a backend test suite that can run on any backend will improve the refactoring and new-backend-development experiences, but I expect this to be merged before that's done.)

Description for the changelog

Implement cursor API supporting arbitrary backend pagination implementations.

- A picture of a cute animal (not mandatory but encouraged)

image

@verythorough
Copy link
Contributor

verythorough commented Apr 20, 2018

Deploy preview for netlify-cms-www ready!

Built with commit dcf6df7

https://deploy-preview-1301--netlify-cms-www.netlify.com

@verythorough
Copy link
Contributor

verythorough commented Apr 20, 2018

Deploy preview for cms-demo ready!

Built with commit dcf6df7

https://deploy-preview-1301--cms-demo.netlify.com

@erquhart
Copy link
Contributor

Excited to see this @Benaiah! Give a heads up when it's ready for a deep dive review.

@Benaiah
Copy link
Contributor Author

Benaiah commented May 22, 2018

Closing this as the commits are a subset of those for the GitLab backend (#1343).

@Benaiah Benaiah closed this May 22, 2018
@erquhart
Copy link
Contributor

@Benaiah safe to delete the branch?

@Benaiah Benaiah deleted the cursor-api branch June 6, 2018 06:00
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.

3 participants