From 8291bf176bbcef3620299c0ab107f2b92d8e5b18 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 10 Dec 2023 12:31:52 +0700 Subject: [PATCH] chore: fix typos --- packages/core/src/types.ts | 1 + packages/hydrogen/src/hooks/use-pixel.ts | 1 - packages/hydrogen/src/weaverse-client.ts | 6 ++---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 459d24b7..245a40d0 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -160,6 +160,7 @@ export type InputType = | "text" | "textarea" | "toggle-group" + | "swatches" declare global { interface Window { diff --git a/packages/hydrogen/src/hooks/use-pixel.ts b/packages/hydrogen/src/hooks/use-pixel.ts index 65541a33..254734d8 100644 --- a/packages/hydrogen/src/hooks/use-pixel.ts +++ b/packages/hydrogen/src/hooks/use-pixel.ts @@ -5,7 +5,6 @@ import { useLocation } from '@remix-run/react' let fetchingKey = '' export function usePixel(context: WeaverseHydrogen) { - // TODO: create a post xhr request to the pixel endpoint let { projectId, pageId, weaverseHost, isDesignMode } = context let location = useLocation() diff --git a/packages/hydrogen/src/weaverse-client.ts b/packages/hydrogen/src/weaverse-client.ts index aef98350..da14eea9 100644 --- a/packages/hydrogen/src/weaverse-client.ts +++ b/packages/hydrogen/src/weaverse-client.ts @@ -196,9 +196,7 @@ export class WeaverseClient { } if (page?.items) { let items = page.items - page.items = await Promise.all( - items.map((item) => this.execComponentLoader(item)), - ) + page.items = await Promise.all(items.map(this.execComponentLoader)) } let data: WeaverseLoaderData = { page, @@ -226,7 +224,7 @@ export class WeaverseClient { execComponentLoader = async (item: HydrogenComponentData) => { let { data = {}, type, id } = item let schema = this.components.find(({ schema }) => schema?.type === type) - let { loader } = schema || {} + let loader = schema?.loader if (loader && typeof loader === 'function') { try { return {