fix: ssr fixes

This commit is contained in:
Philipp Mieden 2025-09-18 13:51:47 +02:00
parent 5821bbfe8a
commit e8e443f1e0
2 changed files with 8 additions and 5 deletions

View File

@ -18,7 +18,7 @@ import React, { useEffect, useState } from "react";
import { Iframe } from "./Iframe"; import { Iframe } from "./Iframe";
import { IsItCool } from "./IsItCool"; import { IsItCool } from "./IsItCool";
import Highlight, { defaultProps } from "prism-react-renderer"; import { Highlight, defaultProps } from "prism-react-renderer";
import Link from "@docusaurus/Link"; import Link from "@docusaurus/Link";
export const GoPlayground = (props: { id: string; proportion: number }) => { export const GoPlayground = (props: { id: string; proportion: number }) => {

View File

@ -15,11 +15,14 @@ export const IsItCool = (props: {
topic: string; topic: string;
id: string; id: string;
}) => { }) => {
const [isCool, setIsCool] = useState(getISCool(props.id)); const [isCool, setIsCool] = useState(false);
useEffect(() => { useEffect(() => {
console.log("well it is cool",props.id, {isCool, SSR}) if (localStorage.getItem(props.id) === yes) {
}, [isCool, SSR]); setIsCool(true);
if (!isCool) { }
}, [props.id]);
if (SSR || !isCool) {
return ( return (
<div> <div>
<button <button