From 69d73b3da2b2b2d4bcf332e931208ea80d1008e2 Mon Sep 17 00:00:00 2001 From: peternandersson Date: Thu, 22 May 2025 13:17:50 -0700 Subject: [PATCH] Initialize state correctly in useVariable --- src/react/hooks.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/react/hooks.ts b/src/react/hooks.ts index c6108ff..f539ca5 100644 --- a/src/react/hooks.ts +++ b/src/react/hooks.ts @@ -163,7 +163,9 @@ export function useVariable( id: string, ): [WorkbookVariable | undefined, Function] { const client = usePlugin(); - const [workbookVariable, setWorkbookVariable] = useState(); + const [workbookVariable, setWorkbookVariable] = useState( + client.config.getVariable(id), + ); useEffect(() => { return client.config.subscribeToWorkbookVariable(id, setWorkbookVariable);