Closed thetrevorharmon closed 4 years ago
This PR resolves https://github.com/thetrevorharmon/gatsby-theme-shopify-core/issues/20 by changing the initial loading step within context provider. When an initial cart object is found, it uses the fetch function to refresh the cart with the latest data from Shopify.
fetch
As a result, there is one extra render. To account for this, renderHookWithContext takes this into account and waits one tick. There is also renderHookWithContextSynchronously which does not wait a tick.
renderHookWithContext
renderHookWithContextSynchronously
This PR resolves https://github.com/thetrevorharmon/gatsby-theme-shopify-core/issues/20 by changing the initial loading step within context provider. When an initial cart object is found, it uses the
fetch
function to refresh the cart with the latest data from Shopify.As a result, there is one extra render. To account for this,
renderHookWithContext
takes this into account and waits one tick. There is alsorenderHookWithContextSynchronously
which does not wait a tick.