vtex / faststore

Digital commerce toolkit for frontend developers
https://faststore.dev
MIT License
189 stars 60 forks source link

Fetch multiple CMS template pages instead of just the first #2314

Closed gvc closed 5 months ago

gvc commented 5 months ago

What's the purpose of this pull request?

Currently, when trying to load contentTypes from the Headless CMS we just fetch the first page and ignore the hasNextPage response from the cmsClient.

How it works?

This PR changes that to load all publishedContentTypes before returning. This might be troublesome if a given account has thousands of content types of the same type (PLP, for instance). We can either increase the page size to make fewer requests or investigate if we can move the filtering to the CMS Client.

How to test it?

I've added tests, but this can be replicated by copying the server/cms/index.ts code to a store's node_modules folder and you should see the effect.

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **faststore-site** | ⬜️ Ignored ([Inspect](https://vercel.com/faststore/faststore-site/JAhE2HJr9zNatZYJPk5srtP8uWqz)) | [Visit Preview](https://faststore-site-git-fix-multiple-pages-loading-faststore.vercel.app) | | May 16, 2024 5:36pm |
codesandbox-ci[bot] commented 5 months ago

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.