fix(FN-4554): prefer deviceCode over duplicate instructions

Fusion-Task-Id: FN-4554
Fusion-Task-Lineage: 12d517c5-1954-4b27-8c63-c7f0dde93d3f
This commit is contained in:
Fusion
2026-05-14 21:25:25 -07:00
committed by gsxdsm
parent 6d072f47f6
commit 91e6d3767f
2 changed files with 3 additions and 1 deletions

View File

@@ -1026,7 +1026,7 @@ export function SettingsModal({
try {
const { url, instructions, manualCode, deviceCode } = await loginProvider(providerId);
if (instructions?.trim()) {
if (instructions?.trim() && !(providerId === "github-copilot" && deviceCode)) {
setLoginInstructions((prev) => ({ ...prev, [providerId]: instructions }));
}
if (manualCode) {

View File

@@ -1643,6 +1643,7 @@ describe("SettingsModal", () => {
});
mockLoginProvider.mockResolvedValueOnce({
url: "https://auth.example.com/login",
instructions: "Enter code: ABCD-1234",
deviceCode: {
userCode: "ABCD-1234",
verificationUri: "https://github.com/login/device",
@@ -1656,6 +1657,7 @@ describe("SettingsModal", () => {
await userEvent.click(within(copilotCard).getByRole("button", { name: "Login" }));
expect(await within(copilotCard).findByText("ABCD-1234")).toBeInTheDocument();
expect(within(copilotCard).queryByTestId("auth-login-instructions-github-copilot")).not.toBeInTheDocument();
await userEvent.click(within(copilotCard).getByRole("button", { name: "Copy code" }));
expect(writeText).toHaveBeenCalledWith("ABCD-1234");