From c68a98eb8a86600c10d47cab4a418a99ff8746e6 Mon Sep 17 00:00:00 2001 From: marcoferreiradev Date: Thu, 13 Feb 2025 19:51:41 -0300 Subject: [PATCH] fix: improve type safety and dynamic imports for Deno Deploy --- components/search/Searchbar/Suggestions.tsx | 6 +++--- main.ts | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/search/Searchbar/Suggestions.tsx b/components/search/Searchbar/Suggestions.tsx index 36d3fd39..5ae881be 100644 --- a/components/search/Searchbar/Suggestions.tsx +++ b/components/search/Searchbar/Suggestions.tsx @@ -39,8 +39,8 @@ function Suggestions( { suggestion }: ComponentProps, ) { const { products = [], searches = [] } = suggestion ?? {}; - const hasProducts = Boolean(products.length); - const hasTerms = Boolean(searches.length); + const hasProducts = Boolean(products?.length); + const hasTerms = Boolean(searches?.length); return (
- {products.map((product, index) => ( + {products?.map((product, index) => ( /// /// +/// + +// these imports are needed to make deno deploy include the files in the bundle +// because we are importing these dynamically in the code and DD doesn't recognize them to be included +import "./components/shipping/Results.tsx"; +import "./components/search/Searchbar/Suggestions.tsx"; import { start } from "$fresh/server.ts"; import config from "./fresh.config.ts";