fix(frontend): render terminal input commands and skip empty outputs (#11537)

This commit is contained in:
sp.wack 2025-10-28 18:32:19 +04:00 committed by GitHub
parent b5920eece6
commit 037a2dca8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,9 +26,11 @@ const renderCommand = (
return;
}
terminal.writeln(
parseTerminalOutput(content.replaceAll("\n", "\r\n").trim()),
);
const trimmedContent = content.replaceAll("\n", "\r\n").trim();
// Only write if there's actual content to avoid empty newlines
if (trimmedContent) {
terminal.writeln(parseTerminalOutput(trimmedContent));
}
};
// Create a persistent reference that survives component unmounts
@ -153,7 +155,7 @@ export const useTerminal = () => {
lastCommandType = commands[i].type;
// Pass true for isUserInput to skip rendering user input commands
// that have already been displayed as the user typed
renderCommand(commands[i], terminal.current, true);
renderCommand(commands[i], terminal.current, false);
}
lastCommandIndex.current = commands.length;
if (lastCommandType === "output") {