Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Feature/switch shopify source #57

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gil--
Copy link
Owner

@gil-- gil-- commented Jan 5, 2019

Due to lack of support for image optimization as well as built in support for querying all products, collections, etc. I’ve decided to switch to a Shopify specific source plugin. There are a number of differences in how queries are structured which resulted in the great number of code changes. There’s definitely some room for refactoring some of the code to reduce dependency on query structure.

We’re usinf ‘gatsby-source-shopify2’ instead of the official one since there are issues with the official Shopify source plugin. Switch between them should be sesmlesss down the line.

Gil Greenberg added 2 commits January 4, 2019 16:50
Not using gatsby-source-shopify which is the official one as there seems to be errors on Gatsby v2. Should be a seamless switch in gatsby-plugins.js once it works again.

We're switching from the generic graphql-source to a Shopify specific source plugin in order to get the benefits of pagination and imageSharp. This does however have potential issues for larger stores as it retrieves ALL products, ALL collections, ALL images, etc. The graphql-source was easier to limit.

Due to how the graphql is structured, there is a considerable number of query structure changes

allProducts && allProducts.forEach(product => {
allProducts && allProducts.data.allShopifyProduct.edges.forEach(product => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

}
}
}
}
`)

allCollections && allCollections.data.shopify.shop.collections.edges.forEach(edge => {
allCollections && allCollections.data.allShopifyCollection.edges.forEach(collection => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@gil-- gil-- force-pushed the feature/switch-shopify-source branch from 3c20a7a to 3acba1e Compare January 7, 2019 21:52
@codeclimate
Copy link

codeclimate bot commented Jan 7, 2019

Code Climate has analyzed commit 3acba1e and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

View more on Code Climate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant