Skip to content

Commit 4004e9e

Browse files
committed
Revert "ENG-377 Changing Checkpoint UI to take less real space on the chat interface (RooCodeInc#2752)"
This reverts commit 2ef4e56.
1 parent 8fb419f commit 4004e9e

File tree

4 files changed

+23
-77
lines changed

4 files changed

+23
-77
lines changed

webview-ui/src/components/chat/BrowserSessionRow.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ const BrowserSessionRow = memo((props: BrowserSessionRowProps) => {
281281
consoleLogs: currentPage?.currentState.consoleLogs,
282282
screenshot: currentPage?.currentState.screenshot,
283283
}
284+
284285
const [actionContent, { height: actionHeight }] = useSize(
285286
<div>
286287
{currentPage?.nextAction?.messages.map((message) => (

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { COMMAND_OUTPUT_STRING, COMMAND_REQ_APP_STRING } from "@shared/combineCo
1717
import { useExtensionState } from "@/context/ExtensionStateContext"
1818
import { findMatchingResourceOrTemplate, getMcpServerDisplayName } from "@/utils/mcp"
1919
import { vscode } from "@/utils/vscode"
20-
import { useChatRowStyles } from "@/hooks/useChatRowStyles"
2120
import { CheckmarkControl } from "@/components/common/CheckmarkControl"
2221
import { CheckpointControls, CheckpointOverlay } from "../common/CheckpointControls"
2322
import CodeAccordian, { cleanPathPrefix } from "../common/CodeAccordian"
@@ -48,12 +47,11 @@ interface ChatRowProps {
4847
isExpanded: boolean
4948
onToggleExpand: () => void
5049
lastModifiedMessage?: ClineMessage
51-
isFirst: boolean
5250
isLast: boolean
5351
onHeightChange: (isTaller: boolean) => void
5452
}
5553

56-
interface ChatRowContentProps extends Omit<ChatRowProps, "onHeightChange" | "isFirst"> {}
54+
interface ChatRowContentProps extends Omit<ChatRowProps, "onHeightChange"> {}
5755

5856
export const ProgressIndicator = () => (
5957
<div
@@ -86,40 +84,36 @@ const Markdown = memo(({ markdown }: { markdown?: string }) => {
8684

8785
const ChatRow = memo(
8886
(props: ChatRowProps) => {
89-
const { isLast, isFirst, onHeightChange, message } = props
87+
const { isLast, onHeightChange, message, lastModifiedMessage } = props
9088
// Store the previous height to compare with the current height
89+
// This allows us to detect changes without causing re-renders
9190
const prevHeightRef = useRef(0)
92-
// Calculate dynamic styles using the custom hook
93-
const { ...chatRowStyles } = useChatRowStyles(message)
9491

95-
const isCheckpointMessage = message.say === "checkpoint_created"
92+
// NOTE: for tools that are interrupted and not responded to (approved or rejected) there won't be a checkpoint hash
93+
let shouldShowCheckpoints =
94+
message.lastCheckpointHash != null &&
95+
(message.say === "tool" ||
96+
message.ask === "tool" ||
97+
message.say === "command" ||
98+
message.ask === "command" ||
99+
// message.say === "completion_result" ||
100+
// message.ask === "completion_result" ||
101+
message.say === "use_mcp_server" ||
102+
message.ask === "use_mcp_server")
96103

97-
// Special handling for first row checkpoint
98-
const checkpointStyles = useMemo(() => {
99-
if (isCheckpointMessage) {
100-
// Apply additional styles for first row checkpoints
101-
if (isFirst) {
102-
return {
103-
...chatRowStyles,
104-
marginTop: "3px", // Add a small margin to ensure visibility
105-
}
106-
}
107-
return chatRowStyles
108-
}
109-
return chatRowStyles
110-
}, [chatRowStyles, isCheckpointMessage, isFirst])
104+
if (shouldShowCheckpoints && isLast) {
105+
shouldShowCheckpoints =
106+
lastModifiedMessage?.ask === "resume_completed_task" || lastModifiedMessage?.ask === "resume_task"
107+
}
111108

112-
// ChatRowContainer with updated styles
113109
const [chatrow, { height }] = useSize(
114-
<ChatRowContainer style={checkpointStyles}>
110+
<ChatRowContainer>
115111
<ChatRowContent {...props} />
112+
{shouldShowCheckpoints && <CheckpointOverlay messageTs={message.ts} />}
116113
</ChatRowContainer>,
117114
)
118115

119116
useEffect(() => {
120-
// Skip height change effects for checkpoint messages
121-
if (isCheckpointMessage) return
122-
123117
// used for partials command output etc.
124118
// NOTE: it's important we don't distinguish between partial or complete here since our scroll effects in chatview need to handle height change during partial -> complete
125119
const isInitialRender = prevHeightRef.current === 0 // prevents scrolling when new element is added since we already scroll for that
@@ -130,7 +124,7 @@ const ChatRow = memo(
130124
}
131125
prevHeightRef.current = height
132126
}
133-
}, [height, isLast, onHeightChange, message, isCheckpointMessage])
127+
}, [height, isLast, onHeightChange, message])
134128

135129
// we cannot return null as virtuoso does not support it so we use a separate visibleMessages array to filter out messages that should not be rendered
136130
return chatrow

webview-ui/src/components/common/CheckmarkControl.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ import { useFloating, offset, flip, shift } from "@floating-ui/react"
1111
interface CheckmarkControlProps {
1212
messageTs?: number
1313
isCheckpointCheckedOut?: boolean
14-
/** Determines if the hover is near the checkpoint marker's visual position (either on the preceding row or the checkpoint row itself) */
15-
isHoveredNearCheckpoint: boolean
1614
}
1715

18-
export const CheckmarkControl = ({ messageTs, isCheckpointCheckedOut, isHoveredNearCheckpoint }: CheckmarkControlProps) => {
16+
export const CheckmarkControl = ({ messageTs, isCheckpointCheckedOut }: CheckmarkControlProps) => {
1917
const [compareDisabled, setCompareDisabled] = useState(false)
2018
const [restoreTaskDisabled, setRestoreTaskDisabled] = useState(false)
2119
const [restoreWorkspaceDisabled, setRestoreWorkspaceDisabled] = useState(false)
@@ -121,13 +119,6 @@ export const CheckmarkControl = ({ messageTs, isCheckpointCheckedOut, isHoveredN
121119

122120
useEvent("message", handleMessage)
123121

124-
// Hide checkpoint if it is not the currently restored one AND the user is not hovering near it.
125-
// This keeps the UI clean but ensures the checkpoint appear on hover for interaction.
126-
const shouldHideCheckpoint = !isCheckpointCheckedOut && !isHoveredNearCheckpoint
127-
if (shouldHideCheckpoint) {
128-
return null
129-
}
130-
131122
return (
132123
<Container isMenuOpen={showRestoreConfirm} $isCheckedOut={isCheckpointCheckedOut} onMouseLeave={handleControlsMouseLeave}>
133124
<i

webview-ui/src/hooks/useChatRowStyles.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)