Skip to content

Commit ba5ba79

Browse files
committed
Memoize the runCode callback.
1 parent 04f3a1e commit ba5ba79

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function AppContent() {
111111
setActiveTab('amaranth-source');
112112
}
113113

114-
async function runCode() {
114+
const runCode = React.useCallback(async () => {
115115
if (running)
116116
return;
117117
try {
@@ -155,7 +155,7 @@ function AppContent() {
155155
setRunning(false);
156156
setOutputOutOfDate(false);
157157
}
158-
}
158+
}, [amaranthSource, amaranthVersion]);
159159

160160
function tabAndPanel({ key, title, titleStyle = {}, content }) {
161161
return [

0 commit comments

Comments
 (0)