mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
fix(tui): treat global events as default location for integration refresh
The v2 integration refresh converted event metadata directly into a
Location.Ref, so the global routing sentinel (directory "global") was
sent to the server as a real filesystem location. LocationServiceMap
built the full project graph for it, and Fff.create({ basePath: "global" })
failed on every refresh after OAuth callback disposal. Map global events
back to the current default location instead.
This commit is contained in:
@@ -56,6 +56,12 @@ function locationQuery(ref?: LocationRef) {
|
||||
return ref ? { directory: ref.directory, workspace: ref.workspaceID } : undefined
|
||||
}
|
||||
|
||||
export function eventLocation(metadata: { directory: string; workspace?: string }): LocationRef | undefined {
|
||||
// kilocode_change - "global" is an event-routing sentinel, not a filesystem location.
|
||||
if (metadata.directory === "global") return
|
||||
return { directory: metadata.directory, workspaceID: metadata.workspace }
|
||||
}
|
||||
|
||||
export const { use: useData, provider: DataProvider } = createSimpleContext({
|
||||
name: "Data",
|
||||
init: () => {
|
||||
@@ -439,7 +445,7 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
|
||||
void result.location.reference.refresh()
|
||||
break
|
||||
case "integration.updated":
|
||||
void result.location.integration.refresh({ directory: metadata.directory, workspaceID: metadata.workspace })
|
||||
void result.location.integration.refresh(eventLocation(metadata)) // kilocode_change
|
||||
break
|
||||
}
|
||||
} // kilocode_change
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { eventLocation } from "../../src/context/data"
|
||||
|
||||
describe("eventLocation", () => {
|
||||
test("uses the default location for global events", () => {
|
||||
expect(eventLocation({ directory: "global" })).toBeUndefined()
|
||||
})
|
||||
|
||||
test("preserves project event locations", () => {
|
||||
expect(eventLocation({ directory: "/repo", workspace: "wsp_test" })).toEqual({
|
||||
directory: "/repo",
|
||||
workspaceID: "wsp_test",
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user