Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/kilo-ui/src/components/diff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,9 @@ export function Diff<T>(props: DiffProps<T>) {
containerWrapper: container,
})
} else {
const oldFile = local.before
const newFile = local.after
if (!oldFile || !newFile) return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Silent no-op guard skips downstream render-completion work

When metadata is falsy this branch is only reachable for the DiffPair variant, where before/after are required (non-optional) at the type level -- the undefined only shows up because local merges both union members. So this guard should never actually trigger at runtime given valid props, but if it ever does (e.g. a caller bug that supplies neither fileDiff nor before/after), the effect now returns before applyScheme(), patchSeparatorLayout(), setRendered(...), and notifyRendered() run -- silently leaving the diff view in a "stuck" state (e.g. onRendered never firing) with no error surfaced. Consider a dev-time warning/invariant here instead of a bare early return, so a misuse is visible rather than manifesting as a UI that never finishes "rendering".


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 00c5da3. The narrowing guard now throws a descriptive invariant error when fileDiff is absent without valid before/after inputs, so malformed props surface immediately instead of silently skipping render-completion work. Direct extension/webview typecheck, lint, and formatting pass.

const beforeContents = before()
const afterContents = after()

Expand All @@ -749,8 +752,8 @@ export function Diff<T>(props: DiffProps<T>) {
}

instance.render({
oldFile: { ...local.before, contents: beforeContents, cacheKey: cacheKey(beforeContents) },
newFile: { ...local.after, contents: afterContents, cacheKey: cacheKey(afterContents) },
oldFile: { ...oldFile, contents: beforeContents, cacheKey: cacheKey(beforeContents) },
newFile: { ...newFile, contents: afterContents, cacheKey: cacheKey(afterContents) },
lineAnnotations: annotations,
containerWrapper: container,
})
Expand Down
1 change: 1 addition & 0 deletions packages/kilo-vscode/knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"webview-ui/kiloclaw/index.tsx",
"webview-ui/marketplace/index.tsx",
"webview-ui/pierre-worker.ts",
"webview-ui/src/assets.d.ts",
"webview-ui/src/index.tsx",
"src/**/__tests__/**/*.{ts,spec.ts}",
"src/**/*.test.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/kilo-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@
"watch-tests": "tsc -p . -w --outDir out",
"pretest": "bun run compile-tests && bun run compile && bun run lint",
"check-types": "tsc --noEmit",
"check-types:webview": "bun script/typecheck.ts --project webview-ui/tsconfig.json",
"check-types:webview": "tsc --noEmit --project webview-ui/tsconfig.json",
"typecheck": "bun run check-types && bun run check-types:webview",
"format": "prettier --write .",
"format:check": "prettier --check .",
Expand Down
38 changes: 0 additions & 38 deletions packages/kilo-vscode/script/typecheck.ts

This file was deleted.

9 changes: 9 additions & 0 deletions packages/kilo-vscode/webview-ui/src/assets.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
declare module "*.svg" {
const src: string
export default src
}

declare module "*?worker&url" {
const src: string
export default src
}
Loading