Lazy-load GitHub picker queries
This commit is contained in:
@@ -834,6 +834,23 @@ describe("Composer attachments", () => {
|
||||
expect(combobox.dataset.anchor).toBe("attached");
|
||||
});
|
||||
|
||||
it("lazily searches GitHub only after the GitHub combobox opens", async () => {
|
||||
renderComposer();
|
||||
await flushAsyncWork();
|
||||
|
||||
expect(mockClient.searchGitHub).not.toHaveBeenCalled();
|
||||
|
||||
click(queryByTestId("message-input-attach-button")!);
|
||||
click(queryByTestId("message-input-attachment-menu-item-github")!);
|
||||
await findByTestId("composer-github-combobox");
|
||||
|
||||
expect(mockClient.searchGitHub).toHaveBeenCalledWith({
|
||||
cwd: "/repo",
|
||||
query: "",
|
||||
limit: 20,
|
||||
});
|
||||
});
|
||||
|
||||
it("closes the GitHub combobox after selecting an item", async () => {
|
||||
renderComposer();
|
||||
|
||||
|
||||
@@ -790,7 +790,7 @@ export function Composer({
|
||||
limit: 20,
|
||||
});
|
||||
},
|
||||
enabled: isConnected && !!client && cwd.trim().length > 0,
|
||||
enabled: isGithubPickerOpen && isConnected && !!client && cwd.trim().length > 0,
|
||||
staleTime: 30_000,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user