-
Notifications
You must be signed in to change notification settings - Fork 63
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
fix(gatsby-source-vtex): page size #799
Conversation
✔️ Deploy Preview for storeui ready! 🔨 Explore the source changes: 19f38f6 🔍 Inspect the deploy log: https://app.netlify.com/sites/storeui/deploys/60ddb1304bb55b0007cba3dd 😎 Browse the preview: https://deploy-preview-799--storeui.netlify.app |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 19f38f6:
|
Co-authored-by: Emerson Laurentino <emersonlaurentino@hotmail.com>
start: () => ({ | ||
// Our search is inclusive, so 0 -> PAGE_SIZE - 1 fetches PAGE_SIZE items | ||
variables: { from: 0, to: PAGE_SIZE - 1 }, | ||
hasNextPage: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it always true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we set this to false we will never reach page 2. Setting this to true makes us fetch at least page 2 and check if we do have more pages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works when we have less than PAGE_SIZE
products as well. An example is storecomponents account that has 50-ish products
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Larícia Mota <lmmc2@cin.ufpe.br>
What's the purpose of this pull request?
Fixes 404 errors while fetching products. Also, adds an option to fetch less products for testing purposes
How it works?
When we made builds on
carrefourbrfood
, we got a 404. This is because we were fetching too much products at once. Decreasing the number of products per fetch should solve this problem.Also, this plugin adds a minProducts option to set the minimum amount of products to be fetched. This can help developing since we can fetch less products on "dev mode" and make a full build in production.