From e8e443f1e0055674fc49d904edf4947e795a3ec1 Mon Sep 17 00:00:00 2001 From: Philipp Mieden Date: Thu, 18 Sep 2025 13:51:47 +0200 Subject: [PATCH] fix: ssr fixes --- foomo/src/components/GoPlayground.tsx | 2 +- foomo/src/components/IsItCool.tsx | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/foomo/src/components/GoPlayground.tsx b/foomo/src/components/GoPlayground.tsx index 2a18efe..1b7ec00 100644 --- a/foomo/src/components/GoPlayground.tsx +++ b/foomo/src/components/GoPlayground.tsx @@ -18,7 +18,7 @@ import React, { useEffect, useState } from "react"; import { Iframe } from "./Iframe"; import { IsItCool } from "./IsItCool"; -import Highlight, { defaultProps } from "prism-react-renderer"; +import { Highlight, defaultProps } from "prism-react-renderer"; import Link from "@docusaurus/Link"; export const GoPlayground = (props: { id: string; proportion: number }) => { diff --git a/foomo/src/components/IsItCool.tsx b/foomo/src/components/IsItCool.tsx index efd1d70..ce74c70 100644 --- a/foomo/src/components/IsItCool.tsx +++ b/foomo/src/components/IsItCool.tsx @@ -15,11 +15,14 @@ export const IsItCool = (props: { topic: string; id: string; }) => { - const [isCool, setIsCool] = useState(getISCool(props.id)); + const [isCool, setIsCool] = useState(false); useEffect(() => { - console.log("well it is cool",props.id, {isCool, SSR}) - }, [isCool, SSR]); - if (!isCool) { + if (localStorage.getItem(props.id) === yes) { + setIsCool(true); + } + }, [props.id]); + + if (SSR || !isCool) { return (