Skip to content

Commit 2ca4b4c

Browse files
committed
fix(web): adapt panel fixtures to current browser bridge and registry
1 parent 6af59a7 commit 2ca4b4c

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2319,7 +2319,6 @@ export default function ChatView(props: ChatViewProps) {
23192319
addPullRequestsSurfaceStable,
23202320
closePreviewPanelStable,
23212321
copyRightPanelFilePathStable,
2322-
createBrowserSurface,
23232322
createBrowserSurfaceStable,
23242323
moveRightPanelSurfaceStable,
23252324
onOpenToolDiffStable,
@@ -3099,6 +3098,7 @@ export default function ChatView(props: ChatViewProps) {
30993098
// and a host only forwards to a sender for the thread it was built for.
31003099
// Updated after commit so a discarded render cannot lend its `onSend`.
31013100
const annotationSenderRef = useRef<ThreadAnnotationSender | null>(null);
3101+
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- lends the committed composer sender to browser annotation callbacks
31023102
useLayoutEffect(() => {
31033103
annotationSenderRef.current = activeThreadKey
31043104
? {
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
import { describe, expect, it, vi } from "vite-plus/test";
22
import { createPanelRegistry } from "./panelRegistry";
33

4+
const metadata = {
5+
title: "Diff",
6+
icon: () => null,
7+
launcherKey: "D",
8+
unavailableHint: "Unavailable.",
9+
unavailableReason: "Unavailable here.",
10+
};
11+
412
describe("panel registration", () => {
513
it("rejects duplicate ids without loading either panel", () => {
614
const load = vi.fn();
7-
const definition = { id: "diff", load } as const;
15+
const definition = { ...metadata, id: "diff", load } as const;
816
expect(() => createPanelRegistry([definition, definition])).toThrow("Duplicate panel id: diff");
917
expect(load).not.toHaveBeenCalled();
1018
});
1119
it("retains lazy component identity without loading on lookup", () => {
1220
const load = vi.fn();
13-
const registry = createPanelRegistry<Record<string, never>, string>([{ id: "diff", load }]);
21+
const registry = createPanelRegistry([{ ...metadata, id: "diff", load }]);
1422
expect(registry.get("diff")?.Component).toBe(registry.get("diff")?.Component);
15-
expect(registry.get("missing")).toBeUndefined();
23+
expect(() => {
24+
// @ts-expect-error Unknown ids are refused at compile time and at runtime.
25+
registry.get("missing");
26+
}).toThrow("Unknown panel id: missing");
1627
expect(load).not.toHaveBeenCalled();
1728
});
1829
});

‎apps/web/src/panels/preview/PreviewSidePanel.browser.test.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ const BROWSER_DEFAULTS = {
3636
};
3737

3838
vi.mock("~/components/preview/previewBridge", () => ({
39-
previewBridge: { pickElement: mocks.pickElement, cancelPickElement: mocks.cancelPickElement },
39+
previewBridge: {
40+
pickElement: mocks.pickElement,
41+
cancelPickElement: mocks.cancelPickElement,
42+
setAnnotationSendEnabled: vi.fn(async () => undefined),
43+
},
4044
}));
4145
vi.mock("~/components/preview/usePreviewSession", () => ({
4246
// Lives exactly as long as the PreviewView instance, so it counts remounts.

0 commit comments

Comments
 (0)