diff --git a/src/App/App.tsx b/src/App/App.tsx index 62c2e62..d45ac56 100644 --- a/src/App/App.tsx +++ b/src/App/App.tsx @@ -150,7 +150,7 @@ export function App() { }, [setTrace, setTime]); // raise input event, producing a new runtime configuration (or a runtime error) - function onRaise(inputEvent: string, param: any) { + const onRaise = (inputEvent: string, param: any) => { if (trace !== null && ast.inputEvents.some(e => e.event === inputEvent)) { const config = current(trace); if (config.kind === "bigstep") { @@ -158,7 +158,7 @@ export function App() { produceNextConfig(simtime, {kind: "input", name: inputEvent, param}, config); } } - } + }; // timer elapse events are triggered by a change of the simulated time (possibly as a scheduled JS event loop timeout) useEffect(() => { let timeout: NodeJS.Timeout | undefined; @@ -219,6 +219,7 @@ export function App() { ...trace!.trace.slice(0, trace!.idx+1), // remove everything after current item newItem, ], + // idx: 0, idx: trace!.idx+1, })); scrollDownSidebar(); diff --git a/src/App/TextDialog.tsx b/src/App/TextDialog.tsx index 627aa04..a478877 100644 --- a/src/App/TextDialog.tsx +++ b/src/App/TextDialog.tsx @@ -1,6 +1,6 @@ import { Dispatch, ReactElement, SetStateAction, useState, KeyboardEvent, useEffect, useRef } from "react"; -import { parse as parseLabel } from "../statecharts/label_parser"; +import { cachedParseLabel } from "@/statecharts/parser"; export function TextDialog(props: {setModal: Dispatch>, text: string, done: (newText: string|undefined) => void}) { const [text, setText] = useState(props.text); @@ -22,7 +22,7 @@ export function TextDialog(props: {setModal: Dispatch event === e.event); if (haveEvent) { @@ -229,7 +232,7 @@ export function parseStatechart(state: VisualEditorState, conns: Connections): [ for (const text of textsSorted) { let parsed: ParsedText; try { - parsed = parseLabel(text.text); // may throw + parsed = cachedParseLabel(text.text); // may throw parsed.uid = text.uid; } catch (e) { if (e instanceof SyntaxError) {