From 7e1f077ce54426a59fa03c613ea2f1e26d6410fc Mon Sep 17 00:00:00 2001 From: iRahul360 Date: Thu, 3 Sep 2026 23:59:23 +0530 Subject: [PATCH] fix: prevent auto-refresh when sketch is stopped --- client/modules/IDE/components/Editor/codemirror.js | 4 +++- client/modules/IDE/components/Editor/index.jsx | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/modules/IDE/components/Editor/codemirror.js b/client/modules/IDE/components/Editor/codemirror.js index 02cf9ed48e..b4b9cd3bdb 100644 --- a/client/modules/IDE/components/Editor/codemirror.js +++ b/client/modules/IDE/components/Editor/codemirror.js @@ -32,6 +32,7 @@ export default function useCodeMirror({ file, files, autorefresh, + isPlaying, clearConsole, startSketch, autocompleteHinter, @@ -52,6 +53,7 @@ export default function useCodeMirror({ onChangeStateRef.current = { fileId: file.id, autorefresh, + isPlaying, project, files }; @@ -69,7 +71,7 @@ export default function useCodeMirror({ const projectId = state.project?.id || 'unsaved'; saveLocalBackup(projectId, state.files); - if (state.autorefresh) { + if (state.autorefresh && state.isPlaying) { clearConsole(); startSketch(); } diff --git a/client/modules/IDE/components/Editor/index.jsx b/client/modules/IDE/components/Editor/index.jsx index 6d883fc192..1ed4d27b9d 100644 --- a/client/modules/IDE/components/Editor/index.jsx +++ b/client/modules/IDE/components/Editor/index.jsx @@ -67,6 +67,7 @@ function Editor({ updateLintMessage, updateFileContent, autorefresh, + isPlaying, clearConsole, startSketch, autocompleteHinter, @@ -124,6 +125,7 @@ function Editor({ file, files, autorefresh, + isPlaying, clearConsole, startSketch, autocompleteHinter, @@ -308,6 +310,7 @@ Editor.propTypes = { setUnsavedChanges: PropTypes.func.isRequired, startSketch: PropTypes.func.isRequired, autorefresh: PropTypes.bool.isRequired, + isPlaying: PropTypes.bool.isRequired, files: PropTypes.arrayOf( PropTypes.shape({ id: PropTypes.string.isRequired,