move 'env' from state to context
This commit is contained in:
parent
9ef160aeb7
commit
f09261df93
13 changed files with 178 additions and 148 deletions
|
|
@ -13,7 +13,6 @@ export interface CallBlockState<
|
|||
InputState=EditorState,
|
||||
> {
|
||||
kind: "call";
|
||||
env: any;
|
||||
fn: FnState;
|
||||
input: InputState;
|
||||
resolved: undefined | Dynamic;
|
||||
|
|
@ -28,7 +27,7 @@ interface CallBlockProps<
|
|||
}
|
||||
|
||||
function headlessCallBlock({state, setState, onResolve}: CallBlockProps) {
|
||||
const [unifyError, setUnifyError] = useState<UnifyError | undefined>(undefined);
|
||||
const [unifyError, setUnifyError] = useState<typeof UnifyError | undefined>(undefined);
|
||||
const {fn, input } = state;
|
||||
const setFn = (fn: EditorState) => {
|
||||
setState({...state, fn});
|
||||
|
|
@ -52,7 +51,7 @@ function headlessCallBlock({state, setState, onResolve}: CallBlockProps) {
|
|||
if (!(e instanceof UnifyError)) {
|
||||
throw e;
|
||||
}
|
||||
setUnifyError(e);
|
||||
setUnifyError(e as typeof UnifyError);
|
||||
onResolve({
|
||||
...state, resolved: undefined
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue