From 0b59f529c78393da6d499283d2e8bd4feb3c3d3c Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 25 Jan 2023 23:25:30 -0800 Subject: [PATCH] Fix Layout bug --- components/Layout/index.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/components/Layout/index.tsx b/components/Layout/index.tsx index f37d4dac..3716d012 100644 --- a/components/Layout/index.tsx +++ b/components/Layout/index.tsx @@ -26,11 +26,17 @@ const Layout = ({ children }: PropsWithChildren) => { }, []) function getToastCookie() { - const updatedAt = new Date(appState.version.updated_at) - const cookieValues = getCookie(`update-${format(updatedAt, 'yyyy-MM-dd')}`) - return cookieValues - ? (JSON.parse(cookieValues as string) as { seen: true }) - : { seen: false } + if (appState.version.updated_at !== '') { + const updatedAt = new Date(appState.version.updated_at) + const cookieValues = getCookie( + `update-${format(updatedAt, 'yyyy-MM-dd')}` + ) + return cookieValues + ? (JSON.parse(cookieValues as string) as { seen: true }) + : { seen: false } + } else { + return { seen: false } + } } function handleToastActionClicked() {