mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-11 00:02:38 +02:00
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:
parent
acff502f42
commit
3b09296291
3 changed files with 22 additions and 20 deletions
|
|
@ -79,16 +79,7 @@ export function ConnectorsPopover({ children, tooltip, open: openProp, onOpenCha
|
||||||
<Button
|
<Button
|
||||||
variant="default"
|
variant="default"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => c.handleReconnect(provider)}
|
||||||
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)
|
|
||||||
}}
|
|
||||||
className="h-7 px-2 text-xs"
|
className="h-7 px-2 text-xs"
|
||||||
>
|
>
|
||||||
Reconnect
|
Reconnect
|
||||||
|
|
|
||||||
|
|
@ -52,16 +52,7 @@ export function ConnectedAccountsSettings({ dialogOpen }: ConnectedAccountsSetti
|
||||||
<Button
|
<Button
|
||||||
variant="default"
|
variant="default"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={() => c.handleReconnect(provider)}
|
||||||
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)
|
|
||||||
}}
|
|
||||||
className="h-7 px-3 text-xs"
|
className="h-7 px-3 text-xs"
|
||||||
>
|
>
|
||||||
Reconnect
|
Reconnect
|
||||||
|
|
|
||||||
|
|
@ -354,6 +354,25 @@ export function useConnectors(active: boolean) {
|
||||||
startConnect('google', { clientId, clientSecret })
|
startConnect('google', { clientId, clientSecret })
|
||||||
}, [startConnect])
|
}, [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) => {
|
const handleDisconnect = useCallback(async (provider: string) => {
|
||||||
setProviderStates(prev => ({
|
setProviderStates(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
|
|
@ -534,6 +553,7 @@ export function useConnectors(active: boolean) {
|
||||||
providerStatus,
|
providerStatus,
|
||||||
hasProviderError,
|
hasProviderError,
|
||||||
handleConnect,
|
handleConnect,
|
||||||
|
handleReconnect,
|
||||||
handleDisconnect,
|
handleDisconnect,
|
||||||
startConnect,
|
startConnect,
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue