tail box close on soft reset

This commit is contained in:
Olivier Gagnon
2021-11-26 18:47:12 -05:00
parent 6e71258a53
commit f17870926b
2 changed files with 11 additions and 1 deletions
+8
View File
@@ -19,6 +19,7 @@ import { Theme } from "@mui/material";
let layerCounter = 0;
export const LogBoxEvents = new EventEmitter<[RunningScript]>();
export const LogBoxClearEvents = new EventEmitter<[]>();
interface Log {
id: string;
@@ -46,6 +47,13 @@ export function LogBoxManager(): React.ReactElement {
[],
);
useEffect(() =>
LogBoxClearEvents.subscribe(() => {
logs = [];
rerender();
}),
);
function close(id: string): void {
logs = logs.filter((l) => l.id !== id);
rerender();