From a46f50dd0fd8894fe7dd6d2e1c750de3817cdab0 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Wed, 27 Jul 2022 17:40:21 -0400 Subject: [PATCH] removed comment, cleaned up a function --- .../src/components/SquiggleEditorImportedBindings.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/components/src/components/SquiggleEditorImportedBindings.tsx b/packages/components/src/components/SquiggleEditorImportedBindings.tsx index db8fd07d..f812a910 100644 --- a/packages/components/src/components/SquiggleEditorImportedBindings.tsx +++ b/packages/components/src/components/SquiggleEditorImportedBindings.tsx @@ -6,13 +6,12 @@ import type { result, errorValue, bindings } from "@quri/squiggle-lang"; function resultDefault( x: result, - defaul: bindings ): bindings { switch (x.tag) { case "Ok": return x.value; case "Error": - return defaul; + return defaultBindings; } } @@ -31,12 +30,11 @@ export const SquiggleEditorImportedBindings: React.FC< SquiggleEditorImportedBindingsProps > = (props) => { const [bindingsResult, setBindingsResult] = React.useState({ - tag: "Ok" as "Ok", + tag: "Ok", value: defaultBindings, } as result); React.useEffect(() => { async function retrieveBindings(fileName: string) { - //: Promise> { let contents = await fetch(fileName).then((response) => { return response.text(); }); @@ -44,7 +42,7 @@ export const SquiggleEditorImportedBindings: React.FC< } retrieveBindings(props.bindingsImportFile); }, []); - const deliveredBindings = resultDefault(bindingsResult, {}); + const deliveredBindings = resultDefault(bindingsResult); const newProps = replaceBindings(props, deliveredBindings); return ; };