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(() => {