Skip to content

Commit 93762dc

Browse files
Merge pull request #17 from contentstack/VP-2037
fix: removed unnecessory packages
2 parents cc95374 + 031fbfb commit 93762dc

3 files changed

Lines changed: 58 additions & 81 deletions

File tree

package-lock.json

Lines changed: 51 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shopify-live-preview-middleware",
3-
"version": "1.1.1",
3+
"version": "1.1.3",
44
"description": "Shopify Live Preview Middleware Service",
55
"type": "module",
66
"main": "src/index.ts",
@@ -26,8 +26,6 @@
2626
"@fastify/rate-limit": "^10.0.0",
2727
"@fastify/swagger": "^9.7.0",
2828
"@fastify/swagger-ui": "^5.2.5",
29-
"adm-zip": "^0.5.10",
30-
"axios": "^1.15.2",
3129
"dotenv": "^16.5.0",
3230
"fastify": "^5.8.5",
3331
"fastify-plugin": "^5.0.0",

src/controllers/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ export const getPreviewDataHandler = async (req: FastifyRequest<{ Body: PreviewD
4949
const { live_preview, ctUid, entryUid, locale, theme_variable } = req.body;
5050
const { liquid_path } = theme_variable;
5151

52-
const entryData: { schema: FieldSchema, entry: Entry } = await livePreviewShopify.fetchData(ctUid, entryUid, live_preview, locale) as { schema: FieldSchema, entry: Entry };
52+
const entryData: { schema: FieldSchema[], entry: Entry } = await livePreviewShopify.fetchData(ctUid, entryUid, live_preview, locale) as { schema: FieldSchema[], entry: Entry };
5353
let shopifyData = { ...theme_variable?.payload };
54-
55-
const keyBasedCt = livePreviewShopify.createContentTypeKeyBased([entryData.schema]);
54+
55+
// CDA include_schema=true returns `schema` as the field array itself — pass it
56+
// directly; wrapping it in another array produced an empty key-based map, which
57+
// routed every field (incl. modular blocks) through the generic no-schema branch.
58+
const keyBasedCt = livePreviewShopify.createContentTypeKeyBased(entryData.schema);
5659
const updatedEntry = entryData.entry;
5760

5861
if (_.get(shopifyData, 'product.metafields.contentstack_products', null)) {

0 commit comments

Comments
 (0)