From ba5ba791a73bce676a31d506f3ea2e61cdc7798f Mon Sep 17 00:00:00 2001 From: Catherine Date: Sun, 18 Aug 2024 16:30:02 +0100 Subject: [PATCH] Memoize the `runCode` callback. --- src/app.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index 4d2c426..a86dc60 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -111,7 +111,7 @@ function AppContent() { setActiveTab('amaranth-source'); } - async function runCode() { + const runCode = React.useCallback(async () => { if (running) return; try { @@ -155,7 +155,7 @@ function AppContent() { setRunning(false); setOutputOutOfDate(false); } - } + }, [amaranthSource, amaranthVersion]); function tabAndPanel({ key, title, titleStyle = {}, content }) { return [