From 3c22a45df3f09ba12164ea5c43ca5211355e4748 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Wed, 24 Jul 2024 17:47:58 -0500 Subject: [PATCH] parse suggestions for handling edge case --- apps/web/app/(dash)/home/history.tsx | 4 ++++ apps/web/app/(dash)/home/page.tsx | 16 ++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/web/app/(dash)/home/history.tsx b/apps/web/app/(dash)/home/history.tsx index c1f8d9d4..307ef4e3 100644 --- a/apps/web/app/(dash)/home/history.tsx +++ b/apps/web/app/(dash)/home/history.tsx @@ -20,6 +20,10 @@ const History = memo(({ setQuery }: { setQuery: (q: string) => void }) => { return; } console.log(suggestions); + if (typeof suggestions.data === "string") { + setSuggestions(JSON.parse(suggestions.data)); + return; + } setSuggestions(suggestions.data.reverse().slice(0, 3)); })(); }, []); diff --git a/apps/web/app/(dash)/home/page.tsx b/apps/web/app/(dash)/home/page.tsx index dfcac577..d192d07d 100644 --- a/apps/web/app/(dash)/home/page.tsx +++ b/apps/web/app/(dash)/home/page.tsx @@ -11,7 +11,7 @@ import { } from "@/app/actions/doers"; import { toast } from "sonner"; import { motion } from "framer-motion"; -import { ChromeIcon, GithubIcon, TwitterIcon } from "lucide-react"; +import { ChromeIcon, GithubIcon, MailIcon, TwitterIcon } from "lucide-react"; import Link from "next/link"; import History from "./history"; @@ -52,10 +52,6 @@ function Page({ searchParams }: { searchParams: Record }) { linkTelegram(); } - if (extensionInstalled) { - toast.success("Extension installed successfully"); - } - getSpaces().then((res) => { if (res.success && res.data) { setSpaces(res.data); @@ -66,15 +62,15 @@ function Page({ searchParams }: { searchParams: Record }) { getSessionAuthToken().then((token) => { if (typeof window === "undefined") return; + if (extensionInstalled) { + toast.success("Extension installed successfully"); + } window.postMessage({ token: token.data }, "*"); }); }, [telegramUser]); return (
- {/* all content goes here */} - {/*
hi {firstTime ? 'first time' : ''}
*/} - }) { Install extension - + Bug report