From 8e5cf6367e81095bfb622814964a9858f81c1dde Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Wed, 5 Apr 2023 22:49:34 -0300 Subject: [PATCH] Generate only the necessary data Signed-off-by: Marcos Candeia --- import_map.json | 2 +- schemas.gen.json | 29 ++--------------------------- sections/VtexProductShelf.tsx | 12 +++--------- 3 files changed, 6 insertions(+), 37 deletions(-) diff --git a/import_map.json b/import_map.json index 2a0fc419..91d53be4 100644 --- a/import_map.json +++ b/import_map.json @@ -1,7 +1,7 @@ { "imports": { "$store/": "./", - "$live/": "https://denopkg.com/deco-cx/live@1793c3980d9244aac8da841a90da40dad5b37a68/", + "$live/": "https://denopkg.com/deco-cx/live@ff1f0c6e08b0d5c25f877ae40223f4e9b559fe01/", "deco-sites/std/": "https://denopkg.com/deco-sites/std@1.0.0-rc.9/", "partytown/": "https://deno.land/x/partytown@0.2.1/", "$fresh/": "https://deno.land/x/fresh@1.1.4/", diff --git a/schemas.gen.json b/schemas.gen.json index 4851352a..72eee274 100644 --- a/schemas.gen.json +++ b/schemas.gen.json @@ -2602,7 +2602,7 @@ ], "title": "deco-sites/fashion/components/ui/BannerGrid.tsx@Props" }, - "ZGVjby1zaXRlcy9mYXNoaW9uL3NlY3Rpb25zL1Z0ZXhQcm9kdWN0U2hlbGYudHN4@Props": { + "ZGVjby1zaXRlcy9mYXNoaW9uL2NvbXBvbmVudHMvcHJvZHVjdC9Qcm9kdWN0U2hlbGYudHN4@Props": { "type": "object", "properties": { "title": { @@ -2625,7 +2625,7 @@ "ZGVjby1zaXRlcy9mYXNoaW9uL3NlY3Rpb25zL1Z0ZXhQcm9kdWN0U2hlbGYudHN4@Props&Props": { "allOf": [ { - "$ref": "#/definitions/ZGVjby1zaXRlcy9mYXNoaW9uL3NlY3Rpb25zL1Z0ZXhQcm9kdWN0U2hlbGYudHN4@Props" + "$ref": "#/definitions/ZGVjby1zaXRlcy9mYXNoaW9uL2NvbXBvbmVudHMvcHJvZHVjdC9Qcm9kdWN0U2hlbGYudHN4@Props" }, { "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvZnVuY3Rpb25zL3Z0ZXhQcm9kdWN0TGlzdC50cw==@Props" @@ -2684,31 +2684,6 @@ ], "title": "deco-sites/fashion/components/search/SearchResult.tsx@Props" }, - "ZGVjby1zaXRlcy9mYXNoaW9uL2NvbXBvbmVudHMvcHJvZHVjdC9Qcm9kdWN0U2hlbGYudHN4@Props": { - "type": "object", - "properties": { - "title": { - "type": "string", - "title": "Title" - }, - "products": { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@Product[]|null", - "title": "Products" - }, - "itemsPerPage": { - "type": [ - "number", - "null" - ], - "title": "Items Per Page" - } - }, - "required": [ - "title", - "products" - ], - "title": "deco-sites/fashion/components/product/ProductShelf.tsx@Props" - }, "ZGVjby1zaXRlcy9mYXNoaW9uL2NvbXBvbmVudHMvZm9vdGVyL0Zvb3Rlci50c3g=@StringItem": { "type": "object", "properties": { diff --git a/sections/VtexProductShelf.tsx b/sections/VtexProductShelf.tsx index 88da70e7..ecd66dbd 100644 --- a/sections/VtexProductShelf.tsx +++ b/sections/VtexProductShelf.tsx @@ -2,18 +2,12 @@ import { HandlerContext } from "$fresh/src/server/types.ts"; import ProductShelf, { Props as ProductShelfProps, } from "$store/components/product/ProductShelf.tsx"; -import { Product } from "deco-sites/std/commerce/types.ts"; import { StateVTEX } from "deco-sites/std/commerce/vtex/types.ts"; import loader, { Props as LoaderProps, } from "deco-sites/std/functions/vtexProductList.ts"; import { LiveConfig } from "https://denopkg.com/deco-cx/live@1.0.0-rc.36/blocks/handler.ts"; -export interface Props { - title: string; - itemsPerPage?: number; -} - function ProductShelfSection(props: ProductShelfProps) { return ; } @@ -22,11 +16,11 @@ export async function getProps( request: Request, ctx: HandlerContext< unknown, - LiveConfig + LiveConfig >, -): Promise { +): Promise> { const { data: products } = await loader(request, ctx, ctx.state.$live); - return { ...ctx.state.$live, products }; + return { products }; } export default ProductShelfSection;