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

perf(): filter by path when loading collection from github backend #6898

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

demshy
Copy link
Member

@demshy demshy commented Aug 30, 2023

Summary

When using the beta "path" option on collections, Github backend was loading all entries in the folder and then filtering them on frontend. On a large use case (4-5 collections in the same parent folder with a lot of entries) this starts to affect performance especially when requests are not cached yet.
This PR adds a filter that will consider the path and i18n language (if this is enabled) before requesting files from backend, therefore significantly decrease the number of xhr requests.
We have been using this on our fork in a large production app for a year now and found no issues so far.

Test plan
To test this, you need to set up collections separated by path, connect straight to the Github backend and observe the number of requests between master branch and this.

collections:
  - name: properties
    ...
    folder: content/properties
    path: '{{slug}}/_index'
    ...
  - name: property-units
    folder: content/properties
    path: '{{slug}}/{{unitlist}}'

Checklist

Please add a x inside each checkbox:

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

@martinjagodic martinjagodic enabled auto-merge (squash) August 31, 2023 08:55
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