Skip to content

Commit 35c64f8

Browse files
waleedlatif1claude
andcommitted
fix(desktop): refresh pending sign-in after every continue and gate on shell support
Re-read the chat's pending sign-in after any continue result so a failed launch that retired the previous handoff cannot leave a stale notice, and require the shell's continue-sign-in bridge before showing the feature, since the profiles cache is shared with the import dialog on older shells. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ea87b72 commit 35c64f8

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/browser-session/use-continue-sign-in.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ interface UseContinueSignInProps {
5151
export function useContinueSignIn({ scopeId, pageUrl }: UseContinueSignInProps) {
5252
const supported = supportsContinueSignIn()
5353
const { data: profiles = [] } = useBrowserImportProfiles(supported)
54-
const { data: pending = null } = usePendingSignIn(scopeId, supported)
54+
const { data: pendingData = null } = usePendingSignIn(scopeId, supported)
55+
const pending = supported ? pendingData : null
5556
const { mutateAsync: startHandoff, isPending: starting } = useStartSignInHandoff(scopeId)
5657
const { mutateAsync: importBack, isPending: importing } = useBringSignInBack(scopeId)
5758
const { mutate: cancelHandoff } = useCancelSignInHandoff(scopeId)
5859
useSyncExternalStore(subscribeToDismissals, dismissalCount, dismissalCount)
5960

6061
const page = parseHttpsPage(pageUrl)
61-
const canContinue = profiles.length > 0 && page !== null
62+
// The profiles cache is shared with the import dialog, which older shells
63+
// also support, so cached profiles alone must not reveal this feature.
64+
const canContinue = supported && profiles.length > 0 && page !== null
6265
const hintHost = page ? signInHintHost(page) : null
6366
const hintVisible =
6467
canContinue && pending === null && hintHost !== null && !dismissedHintHosts.has(hintHost)

‎apps/sim/hooks/queries/browser-import.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export function useStartSignInHandoff(scopeId: string) {
6767
onSuccess: ({ pending }) => {
6868
if (pending) queryClient.setQueryData(browserImportKeys.pendingSignIn(scopeId), pending)
6969
},
70+
// A failed or superseded launch can still retire the chat's previous
71+
// handoff, so the shell's answer replaces whatever the cache last held.
72+
onSettled: () =>
73+
queryClient.invalidateQueries({ queryKey: browserImportKeys.pendingSignIn(scopeId) }),
7074
})
7175
}
7276

0 commit comments

Comments
 (0)