diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2024-03-10 16:23:07 -0400 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2024-03-10 16:23:07 -0400 |
| commit | 367fe51e7e1c55e39299e2e667ca4f399a474019 (patch) | |
| tree | 7529a1ba2f758a54e2bca845af36536e637545ed /src/NodeEditor.tsx | |
| parent | b95a2af981c903489631d7a9a3aa04cab8b18c5a (diff) | |
cleanup
Diffstat (limited to 'src/NodeEditor.tsx')
| -rw-r--r-- | src/NodeEditor.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/NodeEditor.tsx b/src/NodeEditor.tsx index 17e7c27..e4b584d 100644 --- a/src/NodeEditor.tsx +++ b/src/NodeEditor.tsx @@ -63,7 +63,7 @@ export const NodeEditor = () => { const instantiateNode = useMemo(nodeFactory, []); const svgRef = useRef(null); - const nodes = useSignal([ + const initialNodes = useMemo(() => [ instantiateNode(100, 100, nodeRegistry['Linspace']), instantiateNode(350, 200, nodeRegistry['Math']), instantiateNode(350, 50, nodeRegistry['Intersperse']), @@ -72,6 +72,8 @@ export const NodeEditor = () => { instantiateNode(900, 250, nodeRegistry['Plot']), ]); + const nodes = useSignal(initialNodes); + const currentLink = useSignal<null | Omit<LinkData, 'to'>>(null); const links = useSignal<LinkData[]>([]); const allLinks = useComputed(() => (links.value as LinkProps[]).concat(currentLink.value as LinkProps ?? [])); @@ -261,4 +263,4 @@ export const NodeEditor = () => { </main> </> ); -};
\ No newline at end of file +}; |
