From 062a03c7080196ffdfacea54a0d967ecc31f52b1 Mon Sep 17 00:00:00 2001 From: Ayase Minori Date: Mon, 11 Sep 2023 04:30:34 +0000 Subject: [PATCH] Add debugging Signed-off-by: GitHub --- islands/CounterCard.tsx | 4 ++-- routes/index.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/islands/CounterCard.tsx b/islands/CounterCard.tsx index 9b1c4ee..b9ac336 100644 --- a/islands/CounterCard.tsx +++ b/islands/CounterCard.tsx @@ -5,7 +5,7 @@ import axios from "axios-web"; interface SharedProps { hasClicked: Signal; - globalCount: string; + globalCount: Signal; } export default function Counter(props: SharedProps) { @@ -72,7 +72,7 @@ export default function Counter(props: SharedProps) {

- Everyone has clicked the button {parseInt(props.globalCount)} times! + Everyone has clicked the button {props.globalCount} times!

diff --git a/routes/index.tsx b/routes/index.tsx index c399afc..3905664 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -42,13 +42,14 @@ export const handler: Handlers = { // broadcast new value to everyone const bc = new BroadcastChannel("global-count"); bc.postMessage(getGlobalStatistics().toString()); - + return Response.json({ success: true }) } } -export default function Home(data: string) { +export default function Home() { const hasClicked = useSignal(false); + const globalCount = useSignal(0); return (
@@ -58,7 +59,7 @@ export default function Home(data: string) { ./routes/index.tsx file, and refresh.