| @@ -628,13 +628,9 @@ export const connectionExistsMessage = (label: string): string => · 627 unmodified lines |
| 628 | * explicit choice. Personal: a connection is most often a personal credential. */ | 628 | * explicit choice. Personal: a connection is most often a personal credential. */ |
| 629 | export const DEFAULT_CONNECTION_OWNER: Owner = "user"; | 629 | export const DEFAULT_CONNECTION_OWNER: Owner = "user"; |
| 630 | | 630 | |
| 631 | /** The method the modal opens on. OAuth needs a registered app (or a DCR | 631 | /** Prefer browser sign-in when offered; credential methods remain selectable. */ |
| 632 | * round-trip) before "Connect" does anything; a key is one paste. When an | | |
| 633 | * integration declares both, starting on OAuth greets most users with | | |
| 634 | * "Register app" — a dead end — while the working method sits one tab over. | | |
| 635 | * Prefer the first non-OAuth method; OAuth stays one click away. */ | | |
| 636 | export const preferredMethodId = (methods: readonly AuthMethod[]): string => | 632 | export const preferredMethodId = (methods: readonly AuthMethod[]): string => |
| 637 | (methods.find((method) => method.kind !== "oauth") ?? methods[0])?.id ?? ""; | 633 | (methods.find((method) => method.kind === "oauth") ?? methods[0])?.id ?? ""; |
| 638 | | 634 | |
| 639 | const authMethodKey = (method: AuthMethod): string => | 635 | const authMethodKey = (method: AuthMethod): string => |
| 640 | method.source === "custom" ? `custom:${String(method.template)}` : `declared:${method.id}`; | 636 | method.source === "custom" ? `custom:${String(method.template)}` : `declared:${method.id}`; |
| @@ -1582,15 +1578,6 @@ function AddAccountModalView(props: AddAccountModalProps) { · 941 unmodified lines |
| 1582 | [allMethods, methodId], | 1578 | [allMethods, methodId], |
| 1583 | ); | 1579 | ); |
| 1584 | | 1580 | |
| 1585 | useEffect(() => { | | |
| 1586 | if (allMethods.length === 0) { | | |
| 1587 | if (methodId !== "") setMethodId(""); | | |
| 1588 | return; | | |
| 1589 | } | | |
| 1590 | if (allMethods.some((m: AuthMethod) => m.id === methodId)) return; | | |
| 1591 | setMethodId(allMethods[0]!.id); | | |
| 1592 | }, [allMethods, methodId]); | | |
| 1593 | | | |
| 1594 | // Apply the handoff prefill ONCE per handoff key (tracked by ref). The | 1581 | // Apply the handoff prefill ONCE per handoff key (tracked by ref). The |
| 1595 | // effect's deps include `allMethods`, which gets a new identity whenever the | 1582 | // effect's deps include `allMethods`, which gets a new identity whenever the |
| 1596 | // integration refetches — and the wizard itself triggers a refetch mid-flow | 1583 | // integration refetches — and the wizard itself triggers a refetch mid-flow |