first of many performance improvements: no unnecessary TextSVG re-renders - more to follow
This commit is contained in:
parent
af60e811fc
commit
0fc3775a11
14 changed files with 116 additions and 74 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { ReactElement, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { ReactElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { emptyStatechart, Statechart, Transition } from "../statecharts/abstract_syntax";
|
||||
import { handleInputEvent, initialize, RuntimeError } from "../statecharts/interpreter";
|
||||
|
|
@ -85,9 +85,9 @@ export function App() {
|
|||
const plant = plants.find(([pn, p]) => pn === plantName)![1];
|
||||
|
||||
const editorState = historyState.current;
|
||||
const setEditorState = (cb: (value: VisualEditorState) => VisualEditorState) => {
|
||||
const setEditorState = useCallback((cb: (value: VisualEditorState) => VisualEditorState) => {
|
||||
setHistoryState(historyState => ({...historyState, current: cb(historyState.current)}));
|
||||
}
|
||||
}, [setHistoryState]);
|
||||
|
||||
const refRightSideBar = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue