Skip to content

Commit 149ea1c

Browse files
committed
clean up
1 parent 7a2887a commit 149ea1c

File tree

6 files changed

+43
-114
lines changed

6 files changed

+43
-114
lines changed

pnpm-lock.yaml

Lines changed: 14 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"hast-util-to-jsx-runtime": "^2.3.6",
4646
"i18next": "^25.0.0",
4747
"i18next-http-backend": "^3.0.2",
48-
"katex": "^0.16.11",
4948
"knuth-shuffle-seeded": "^1.0.6",
5049
"lru-cache": "^11.1.0",
5150
"lucide-react": "^0.518.0",
@@ -67,7 +66,6 @@
6766
"remove-markdown": "^0.6.0",
6867
"shell-quote": "^1.8.2",
6968
"shiki": "^3.2.1",
70-
"source-map": "^0.7.4",
7169
"styled-components": "^6.1.13",
7270
"tailwind-merge": "^3.0.0",
7371
"tailwindcss": "^4.0.0",
@@ -85,15 +83,13 @@
8583
"@testing-library/react": "^16.2.0",
8684
"@testing-library/user-event": "^14.6.1",
8785
"@types/jest": "^29.0.0",
88-
"@types/katex": "^0.16.7",
8986
"@types/node": "20.x",
9087
"@types/react": "^18.3.23",
9188
"@types/react-dom": "^18.3.5",
9289
"@types/shell-quote": "^1.7.5",
9390
"@types/vscode-webview": "^1.57.5",
9491
"@vitejs/plugin-react": "^4.3.4",
9592
"@vitest/ui": "^3.2.3",
96-
"identity-obj-proxy": "^3.0.0",
9793
"jsdom": "^26.0.0",
9894
"typescript": "5.8.3",
9995
"vite": "6.3.5",

webview-ui/src/components/file-changes/FilesChangedOverview.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
6161

6262
// Simple double-click prevention
6363
const [isProcessing, setIsProcessing] = React.useState(false)
64+
const timeoutRef = React.useRef<NodeJS.Timeout | null>(null)
65+
66+
// Cleanup timeout on unmount
67+
React.useEffect(() => {
68+
return () => {
69+
if (timeoutRef.current) {
70+
clearTimeout(timeoutRef.current)
71+
}
72+
}
73+
}, [])
6474

6575
const handleWithDebounce = React.useCallback(
6676
async (operation: () => void) => {
@@ -73,7 +83,10 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
7383
// Debug logging removed for production
7484
}
7585
// Brief delay to prevent double-clicks
76-
setTimeout(() => setIsProcessing(false), 300)
86+
if (timeoutRef.current) {
87+
clearTimeout(timeoutRef.current)
88+
}
89+
timeoutRef.current = setTimeout(() => setIsProcessing(false), 300)
7790
},
7891
[isProcessing],
7992
)
@@ -136,6 +149,7 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
136149
return (
137150
<div
138151
className="files-changed-overview"
152+
data-testid="files-changed-overview"
139153
style={{
140154
border: "1px solid var(--vscode-panel-border)",
141155
borderRadius: "4px",
@@ -180,7 +194,7 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
180194
transition: "transform 0.2s ease",
181195
}}
182196
/>
183-
<h3 style={{ margin: 0, fontSize: "14px", fontWeight: "bold" }}>
197+
<h3 style={{ margin: 0, fontSize: "14px", fontWeight: "bold" }} data-testid="files-changed-header">
184198
{t("file-changes:summary.count_with_changes", {
185199
count: files.length,
186200
changes: totalChanges,
@@ -197,6 +211,7 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
197211
onClick={() => handleWithDebounce(onRejectAll)}
198212
disabled={isProcessing}
199213
tabIndex={0}
214+
data-testid="reject-all-button"
200215
style={{
201216
backgroundColor: "var(--vscode-button-secondaryBackground)",
202217
color: "var(--vscode-button-secondaryForeground)",
@@ -214,6 +229,7 @@ const FilesChangedOverview: React.FC<FilesChangedOverviewProps> = ({
214229
onClick={() => handleWithDebounce(onAcceptAll)}
215230
disabled={isProcessing}
216231
tabIndex={0}
232+
data-testid="accept-all-button"
217233
style={{
218234
backgroundColor: "var(--vscode-button-background)",
219235
color: "var(--vscode-button-foreground)",

webview-ui/src/components/file-changes/FilesChangedOverviewWrapper.tsx

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

webview-ui/src/components/file-changes/__tests__/integration/WebviewMessageFlow.integration.spec.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { ExtensionStateContext } from "@src/context/ExtensionStateContext"
99
import { vscode } from "@src/utils/vscode"
1010
import { FileChangeType } from "@roo-code/types"
1111
import FilesChangedOverview from "../../FilesChangedOverview"
12-
import FilesChangedOverviewWrapper from "../../FilesChangedOverviewWrapper"
1312

1413
// Mock vscode API
1514
vi.mock("@src/utils/vscode", () => ({
@@ -200,14 +199,21 @@ describe("FilesChangedOverview Webview Message Flow Integration", () => {
200199
currentFileChangeset: { baseCheckpoint: "abc123", files: [] },
201200
}
202201

203-
const { container } = render(
202+
render(
204203
<ExtensionStateContext.Provider value={emptyState as any}>
205-
<FilesChangedOverviewWrapper />
204+
<FilesChangedOverview
205+
changeset={{ baseCheckpoint: "abc123", files: [] }}
206+
onViewDiff={(uri) => vscode.postMessage({ type: "viewDiff", uri })}
207+
onAcceptFile={(uri) => vscode.postMessage({ type: "acceptFileChange", uri })}
208+
onRejectFile={(uri) => vscode.postMessage({ type: "rejectFileChange", uri })}
209+
onAcceptAll={() => vscode.postMessage({ type: "acceptAllFileChanges" })}
210+
onRejectAll={() => vscode.postMessage({ type: "rejectAllFileChanges" })}
211+
/>
206212
</ExtensionStateContext.Provider>,
207213
)
208214

209-
// Wrapper returns null for empty states, so container should be empty
210-
expect(container.firstChild).toBeNull()
215+
// Component should show empty state header
216+
expect(screen.getByTestId("files-changed-header")).toBeInTheDocument()
211217
})
212218
})
213219

webview-ui/src/components/file-changes/index.ts

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

0 commit comments

Comments
 (0)