Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Issue with useGid function #90

Open
lewisbamboo opened this issue Jul 21, 2023 · 0 comments
Open

Issue with useGid function #90

lewisbamboo opened this issue Jul 21, 2023 · 0 comments

Comments

@lewisbamboo
Copy link

Losing my sanity with this bug.

I replaced AccordianBody with the main with regular 'body' type. This allows all the modules from the main body, such as images, and products. All the modules work fine with one notable exception, Products. When I try to use the Product module inside of an Accordion, it does not work.

The first issue I found is the module object is different for a product when inside of an Accordion.

Outside Accordion Block:
{"_key":"308e2cca183a","productWithVariant":{"variantGid":"gid://shopify/ProductVariant/39260714565823","_id":"shopifyProduct-6539667636415","_type":"productWithVariant","available":true,"gid":"gid://shopify/Product/6539667636415","slug":"installation-kit"}}
Inside Accordion Block:
{"_type":"module.product","_key":"11cfb4be7340","productWithVariant":{"product":{"_weak":true,"_ref":"shopifyProduct-6539667636415","_type":"reference"},"_type":"productWithVariant","variant":{"_type":"reference","_weak":true,"_ref":"shopifyProductVariant-39260714565823"}}}

Instead of a 'gid' object, it only has a '_ref' object, and several other differences. I struggled to figure this out, so I extracted the ID's from '_ref' and passed those to getGid() instead.

However, when I pass a gid into getGid() I get no response.

I'm still fairly new to react and brand new to hydrogen/sanity, I have a feeling there is some type of context/cache I am missing but can't pinpoint it. Any help would be greatly appreciated!

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

No branches or pull requests

1 participant