-
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
feat(collections): Source collections from category tree #871
Conversation
✔️ Deploy Preview for storeui ready! 🔨 Explore the source changes: e0b1a54 🔍 Inspect the deploy log: https://app.netlify.com/sites/storeui/deploys/6103fde028a18400072b6035 😎 Browse the preview: https://deploy-preview-871--storeui.netlify.app |
44e23c0
to
5723a7d
Compare
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 e0b1a54:
|
ee9b278
to
3763e15
Compare
3d20afa
to
0ebc2dc
Compare
Co-authored-by: Larícia Mota <lmmc2@cin.ufpe.br>
Co-authored-by: Igor Brasileiro <brasileiro456@gmail.com>
What's the purpose of this pull request?
This PR is the first iteration after this discussion #825 .
This PR makes
StoreCollection
to be sourced by@vtex/gatsby-source-vtex
for Brands/Categories. Also, this exports thePLP
contentType from the CMS and adds first class support to the catalog in the CMS plugin.How it works
@vtex/gatsby-source-vtex
has gained a new parameter. This parameter is called:sourceCollections
. When this param is set, the plugin will list all categories/brands and create a correspondingStoreCollection
for each.@vtex/gatsby-plugin-cms
now exports a new contentType calledPLP
. When sourcing data, ifgatsby-plugin-cms
encounters an instancePLP
, it will get the correspondingStoreCollection
and add thisPLP
as a foreign key ofStoreCollection
and add the corresponding SearchParams.In the end, the store will have the following schema:
![image](https://user-images.githubusercontent.com/1753396/127517266-5df5c9cb-8611-4fad-be94-62f168709653.png)
Future Work
As you can see, this is only a partial implementation of what's described on #825 and requires more PRs to fully implement the RFC. I intend to do more PRs later to finish implementing the other use cases discussed on #825 and incremental builds. I didn't do all in one single PR because this would create a HUGE PR.
How to test it
The sole intent of this PR is to create new data to the Gatsby's data layer and nothing should change in any store having this version. Make sure this is the case for:
https://github.com/vtex-sites/storecomponents.store/pull/1060
https://github.com/vtex-sites/btglobal.store/pull/729
https://github.com/vtex-sites/marinbrasil.store/pull/572