Show undo/redo controls even when builder output is empty

This commit is contained in:
Liam Hetherington
2026-02-11 09:46:54 +00:00
parent 1ce02060e8
commit 6cc4258d75

View File

@@ -1984,7 +1984,12 @@ function renderMessages(session) {
}
el.chatArea.appendChild(userCard);
if (msg.reply || msg.error || (status === 'running' && msg.partialOutput)) {
const isOpencodeMsg = msg.cli === 'opencode' || msg.phase === 'build';
const isLatestMessage = latestMessage && latestMessage.id === msg.id;
const shouldShowUndoRedo = isOpencodeMsg && isLatestMessage && (status === 'done' || status === 'error' || status === 'cancelled');
const shouldRenderAssistantCard = msg.reply || msg.error || (status === 'running' && msg.partialOutput) || shouldShowUndoRedo;
if (shouldRenderAssistantCard) {
console.log('[RenderMessages] Creating assistant card for message:', {
id: msg.id,
cli: msg.cli,
@@ -2015,10 +2020,6 @@ function renderMessages(session) {
assistantMeta.appendChild(rawBtn);
// Add Undo/Redo buttons - show for latest message when done, errored, or cancelled
const isOpencodeMsg = msg.cli === 'opencode' || msg.phase === 'build';
const isLatestMessage = latestMessage && latestMessage.id === msg.id;
const shouldShowUndoRedo = isOpencodeMsg && isLatestMessage && (status === 'done' || status === 'error' || status === 'cancelled');
if (shouldShowUndoRedo) {
const undoBtn = document.createElement('button');
undoBtn.className = 'ghost';