BUGFIX: Active Scripts page may mix up UI after prestige (#2303)

This commit is contained in:
catloversg
2025-08-30 02:19:44 +07:00
committed by GitHub
parent 8bd1c4af24
commit f8329813e5
2 changed files with 5 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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} />
))}
</>
);