Skip to content

Commit 69d73b3

Browse files
Initialize state correctly in useVariable
1 parent e0ef1c7 commit 69d73b3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/react/hooks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ export function useVariable(
163163
id: string,
164164
): [WorkbookVariable | undefined, Function] {
165165
const client = usePlugin();
166-
const [workbookVariable, setWorkbookVariable] = useState<WorkbookVariable>();
166+
const [workbookVariable, setWorkbookVariable] = useState<WorkbookVariable>(
167+
client.config.getVariable(id),
168+
);
167169

168170
useEffect(() => {
169171
return client.config.subscribeToWorkbookVariable(id, setWorkbookVariable);

0 commit comments

Comments
 (0)