Implement execution status polling and enhance input handling in EditorArea and Panel components

This commit is contained in:
2025-03-30 21:34:45 +05:30
parent 918b323cda
commit 1cbb4f3c35
3 changed files with 61 additions and 14 deletions

View File

@@ -37,11 +37,11 @@ const Panel = ({
if (e.key === "Enter") {
if (inputBuffer.trim() && onInputSubmit) {
e.preventDefault();
onUserInputChange(inputBuffer);
setTimeout(() => {
onInputSubmit();
setInputBuffer("");
}, 10);
// Update parent's userInput state directly and call submit in the same function
// instead of using setTimeout which creates a race condition
onUserInputChange(inputBuffer);
onInputSubmit(inputBuffer); // Pass inputBuffer directly to avoid race condition
setInputBuffer("");
}
} else if (e.key === "Backspace") {
setInputBuffer((prev) => prev.slice(0, -1));