From 0f58c4426134f8921fc0e5832ed39783e441e42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Jane=C4=8Dek?= Date: Sat, 13 May 2023 09:00:47 +0200 Subject: [PATCH] fix: build errors (#145) --- .../badges/created-ago-badge/index.tsx | 2 +- src/app/components/header/buttons.tsx | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/app/components/badges/created-ago-badge/index.tsx b/src/app/components/badges/created-ago-badge/index.tsx index 735c1198..2237eed6 100644 --- a/src/app/components/badges/created-ago-badge/index.tsx +++ b/src/app/components/badges/created-ago-badge/index.tsx @@ -7,7 +7,7 @@ import { useMemo, useState, useEffect } from "react" import Badge from "../badge" const CreatedAgoBadge = ({ createdAt }: { createdAt: string | Date }) => { - const createdDate = new Date(createdAt) + const createdDate = useMemo(() => new Date(createdAt), [createdAt]) const [time, setTimeAgo] = useState(timeAgo(createdDate)) const { setToast } = useToasts() diff --git a/src/app/components/header/buttons.tsx b/src/app/components/header/buttons.tsx index 16c172b0..c064afd3 100644 --- a/src/app/components/header/buttons.tsx +++ b/src/app/components/header/buttons.tsx @@ -1,6 +1,6 @@ "use client" -import { useSelectedLayoutSegment, useSelectedLayoutSegments } from "next/navigation" +import { useSelectedLayoutSegments } from "next/navigation" import FadeIn from "@components/fade-in" import { setDriftTheme } from "src/app/lib/set-theme" import { @@ -47,12 +47,14 @@ export function HeaderButtons({ }) { const { isAdmin, userId } = useSessionSWR() const { resolvedTheme } = useTheme(); - return getButtons({ - isAuthenticated, - theme: resolvedTheme ? resolvedTheme : initialTheme, - isAdmin, - userId - }) + return <> + {getButtons({ + isAuthenticated, + theme: resolvedTheme ? resolvedTheme : initialTheme, + isAdmin, + userId + })} + } function NavButton(tab: Tab) {