Shopify / hydrogen-demo-store

This template contains a full-featured setup of components, queries and tooling to get started with Hydrogen. It is deployed to https://hydrogen.shop
100 stars 34 forks source link

Empty `headers` export #49

Open ramiroazar opened 3 months ago

ramiroazar commented 3 months ago

We often look at the demo store for reference.

I'm having trouble understanding the current caching strategy.

I can see that routes and loaders share headers.

https://github.com/Shopify/hydrogen-demo-store/blob/ea1db72e61efc5df41cafaabf4c33a902ed3ec1e/app/routes/(%24locale).products.%24productHandle.tsx#L39

However, the headers export doesn't seem to be doing anything, since headers were removed from loaders.

https://github.com/Shopify/hydrogen/pull/991

Can someone please explain the reasoning behind that pull request a bit more?

Cart requests are deferred and cart components are suspended, but are they still at risk of incorrectly getting cached?

https://github.com/Shopify/hydrogen-demo-store/blob/ea1db72e61efc5df41cafaabf4c33a902ed3ec1e/app/root.tsx#L91

https://github.com/Shopify/hydrogen-demo-store/blob/ea1db72e61efc5df41cafaabf4c33a902ed3ec1e/app/components/Layout.tsx#L107

https://github.com/Shopify/hydrogen-demo-store/blob/ea1db72e61efc5df41cafaabf4c33a902ed3ec1e/app/components/Layout.tsx#L338

Is there some way of leveraging route and/or loader caching for improved performance without interfering with the cart components?