FIX[WebApp]: Simplify loading logic of workbook (#87)
Note that previously the model would have been fetched twice
This commit is contained in:
committed by
GitHub
parent
40aa8bebaf
commit
83a4431417
@@ -24,20 +24,17 @@ function App() {
|
|||||||
const model_bytes = new Uint8Array(
|
const model_bytes = new Uint8Array(
|
||||||
await (await fetch(`./${modelName}`)).arrayBuffer(),
|
await (await fetch(`./${modelName}`)).arrayBuffer(),
|
||||||
);
|
);
|
||||||
const _model = Model.from_bytes(model_bytes);
|
setModel(Model.from_bytes(model_bytes));
|
||||||
if (!model) setModel(_model);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const _model = new Model("en", "UTC");
|
setModel(new Model("en", "UTC"));
|
||||||
if (!model) setModel(_model);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const _model = new Model("en", "UTC");
|
setModel(new Model("en", "UTC"));
|
||||||
if (!model) setModel(_model);
|
|
||||||
}
|
}
|
||||||
if (!workbookState) setWorkbookState(new WorkbookState());
|
setWorkbookState(new WorkbookState());
|
||||||
}
|
}
|
||||||
start();
|
start();
|
||||||
}, [model, workbookState]);
|
}, []);
|
||||||
|
|
||||||
if (!model || !workbookState) {
|
if (!model || !workbookState) {
|
||||||
return <Loading>Loading</Loading>;
|
return <Loading>Loading</Loading>;
|
||||||
|
|||||||
Reference in New Issue
Block a user