Read product extensions off the shape Elastic Path returns - #443
Merged
Conversation
extractRawExtensions still looked for `rawData.data.attributes.extensions`, but 0.4.0 removed rawData — the type is the raw shape, so extensions sit on attributes. It returned null for every live product, leaving $ctx.productExtensions empty and every extension binding blank on a real storefront. The canvas hid it: EPProductProvider substitutes MOCK_EXTENSION_TEMPLATES when the live map is empty, so Studio showed plausible placeholder labels. The unit test hid it too, asserting the removed shape. Reads attributes.extensions first, then a bundle's rawData (which holds the product object, not an envelope), then the pre-0.4.0 envelope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extractRawExtensionsstill looked forrawData.data.attributes.extensions, but 0.4.0 removedrawData— the type is the raw shape, so extensions sit onattributes(ADR-0002). It returnednullfor every live product, leaving$ctx.productExtensionsempty and every extension binding blank on a real storefront.Two things hid it.
EPProductProvidersubstitutesMOCK_EXTENSION_TEMPLATESwhen the live map is empty in canvas, so Studio showed plausible placeholder labels; and the unit test asserted the removed shape, so it stayed green.Now reads
attributes.extensionsfirst, then a bundle'srawData(which holds the product object, not an envelope — the old chain never matched that either), then the pre-0.4.0 envelope.Found while migrating a production storefront export: the product had all 28 extension fields on the wire and the page rendered none of them. Needs to land in 0.4.0, which is still unpublished — npm serves 0.3.0.