mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
BUGFIX: Active Scripts page may mix up UI after prestige (#2303)
This commit is contained in:
@@ -3,12 +3,15 @@ import type { WorkerScript } from "./WorkerScript";
|
||||
import { Settings } from "../Settings/Settings";
|
||||
|
||||
export const recentScripts: RecentScript[] = [];
|
||||
let recentScriptId = 0;
|
||||
|
||||
export function AddRecentScript(workerScript: WorkerScript): void {
|
||||
if (recentScripts.find((r) => r.runningScript.pid === workerScript.pid)) return;
|
||||
|
||||
const killedTime = new Date();
|
||||
++recentScriptId;
|
||||
recentScripts.unshift({
|
||||
id: recentScriptId,
|
||||
timeOfDeath: killedTime,
|
||||
runningScript: workerScript.scriptRef,
|
||||
});
|
||||
@@ -19,6 +22,7 @@ export function AddRecentScript(workerScript: WorkerScript): void {
|
||||
}
|
||||
|
||||
export interface RecentScript {
|
||||
id: number;
|
||||
timeOfDeath: Date;
|
||||
runningScript: RunningScript;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export function RecentScriptsPage(): React.ReactElement {
|
||||
<>
|
||||
<Typography>List of all recently killed scripts.</Typography>
|
||||
{recentScripts.map((r) => (
|
||||
<RecentScriptAccordion key={r.runningScript.pid} recentScript={r} />
|
||||
<RecentScriptAccordion key={r.id} recentScript={r} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user