fix: route Google reconnect through rowboat flow when signed in

The Reconnect button on the Google account row always opened the BYOK
client-ID modal, even for users signed into Rowboat — who should get
the managed-credentials browser flow instead. The non-reconnect Connect
button already branched correctly via useConnectors.handleConnect; the
reconnect path bypassed it. Adds a handleReconnect helper that mirrors
the same branching, and routes both call sites (popover and settings)
through it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ramnique Singh 2026-05-08 13:16:59 +05:30
parent acff502f42
commit 3b09296291
3 changed files with 22 additions and 20 deletions

View file

@ -79,16 +79,7 @@ export function ConnectorsPopover({ children, tooltip, open: openProp, onOpenCha
<Button
variant="default"
size="sm"
onClick={() => {
if (provider === 'google') {
c.setGoogleClientIdDescription(
"To keep your Google account connected, please re-enter your client ID. You only need to do this once."
)
c.setGoogleClientIdOpen(true)
return
}
c.startConnect(provider)
}}
onClick={() => c.handleReconnect(provider)}
className="h-7 px-2 text-xs"
>
Reconnect

View file

@ -52,16 +52,7 @@ export function ConnectedAccountsSettings({ dialogOpen }: ConnectedAccountsSetti
<Button
variant="default"
size="sm"
onClick={() => {
if (provider === 'google') {
c.setGoogleClientIdDescription(
"To keep your Google account connected, please re-enter your client ID. You only need to do this once."
)
c.setGoogleClientIdOpen(true)
return
}
c.startConnect(provider)
}}
onClick={() => c.handleReconnect(provider)}
className="h-7 px-3 text-xs"
>
Reconnect

View file

@ -354,6 +354,25 @@ export function useConnectors(active: boolean) {
startConnect('google', { clientId, clientSecret })
}, [startConnect])
// Reconnect flow used by the "Reconnect" button. Mirrors handleConnect's
// rowboat-vs-BYOK branching for Google so signed-in users don't get the
// client-ID modal — they just re-run the managed-credentials browser flow.
const handleReconnect = useCallback(async (provider: string) => {
if (provider === 'google') {
const isSignedIntoRowboat = providerStates.rowboat?.isConnected ?? false
if (isSignedIntoRowboat) {
await startConnect('google')
return
}
setGoogleClientIdDescription(
"To keep your Google account connected, please re-enter your client ID. You only need to do this once."
)
setGoogleClientIdOpen(true)
return
}
await startConnect(provider)
}, [startConnect, providerStates])
const handleDisconnect = useCallback(async (provider: string) => {
setProviderStates(prev => ({
...prev,
@ -534,6 +553,7 @@ export function useConnectors(active: boolean) {
providerStatus,
hasProviderError,
handleConnect,
handleReconnect,
handleDisconnect,
startConnect,