From 04baa49f3ad9ee5bd3d281bafaeda6062ee6bdc0 Mon Sep 17 00:00:00 2001 From: Neta London <67196883+netalondon@users.noreply.github.com> Date: Wed, 8 May 2024 13:23:13 +0300 Subject: [PATCH] Bug: ASM/CPU titles whould disappear after re-clicking header button (#293) --- web/src/pages/asm.tsx | 9 ++++++--- web/src/pages/cpu.tsx | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/web/src/pages/asm.tsx b/web/src/pages/asm.tsx index d53eb1bda..ddc0af680 100644 --- a/web/src/pages/asm.tsx +++ b/web/src/pages/asm.tsx @@ -29,12 +29,15 @@ export const Asm = () => { const [showSymbolTable, setShowSymbolTable] = useState(true); + useEffect(() => { + if (state?.path) { + setTitle(state.path.split("/").pop() ?? ""); + } + }); + useEffect(() => { if (toolStates.asmState) { actions.overrideState(toolStates.asmState); - if (toolStates.asmState.path) { - setTitle(toolStates.asmState.path.split("/").pop() ?? ""); - } } }, []); diff --git a/web/src/pages/cpu.tsx b/web/src/pages/cpu.tsx index 73abbba83..78f1a1826 100644 --- a/web/src/pages/cpu.tsx +++ b/web/src/pages/cpu.tsx @@ -43,6 +43,10 @@ export const CPU = () => { useEffect(() => { toolStates.setCpuState(fileName, state.sim.ROM, romFormat); + if (fileName) { + const name = fileName.split("/").pop() ?? ""; + setTitle(name); + } }); useEffect(() => {