cleanId in ProductForm component #30
Unanswered
SMccarrick
asked this question in
Q&A
Replies: 1 comment 5 replies
-
Midway was created from a destructuring of a number of other headless sites of similar structure, it's possible the cleanId had a purpose in another build and was simply unknowingly left in this portion of code. What I imagine it's used for is matching against sanity product/variant ids you may use within the system. Because Shopify returns back the encoded versions it's harder to match against the sanity instances that are using the decoded variants. This could be refactored to the point that Sanity stores the encoded version which would prevent the need to do so much of this encoding/decoding nonsense. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @iamkevingreen
First off I'd just like to thank you for this great template!
I just have a quick question about the
ProductForm
component. You're usingshopify-gid
to encode and decode an id. You then set the decoded value tocleanId
. I can't see wherecleanId
is used. It seems its just set and then never actually read anywhere. Would you be able to explain the purpose of this, please?Link to the code in question:
midway/web/src/components/product/form.tsx
Lines 38 to 49 in 4c7e8cb
Cheers
Stephen
Beta Was this translation helpful? Give feedback.
All reactions