Merge pull request #2671 from gianfun/fix_ns_tail_behavior

Fix ns.tail() behaviour for multiple calls
This commit is contained in:
hydroflame 2022-01-17 16:01:34 -05:00 committed by GitHub
commit 1d83247f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,14 +40,12 @@ export function LogBoxManager(): React.ReactElement {
() =>
LogBoxEvents.subscribe((script: RunningScript) => {
const id = script.server + "-" + script.filename + script.args.map((x: any): string => `${x}`).join("-");
if (logs.find((l) => l.id === id)) close(id);
Promise.resolve().then(() => {
logs.push({
id: id,
script: script,
});
rerender();
})
if (logs.find((l) => l.id === id)) return;
logs.push({
id: id,
script: script,
});
rerender();
}),
[],
);