email and calendar empty states now check only native google oauth

This commit is contained in:
Arjun 2026-05-23 09:25:26 +05:30
parent 6094ac508a
commit eb4b11a530
2 changed files with 16 additions and 10 deletions

View file

@ -843,7 +843,7 @@ export function EmailView({ initialThreadId, threadIdVersion }: EmailViewProps =
const [refreshing, setRefreshing] = useState(!hadPersistedDataOnMount.current)
const [error, setError] = useState<string | null>(null)
const [query, setQuery] = useState('')
// Gmail connection status — null while checking, false shows the connect prompt.
// Gmail sync uses the native Google OAuth connection.
const [emailConnected, setEmailConnected] = useState<boolean | null>(null)
const [settingsOpen, setSettingsOpen] = useState(false)
@ -851,15 +851,18 @@ export function EmailView({ initialThreadId, threadIdVersion }: EmailViewProps =
let cancelled = false
const check = async () => {
try {
const result = await window.ipc.invoke('composio:get-connection-status', { toolkitSlug: 'gmail' })
if (!cancelled) setEmailConnected(result.isConnected)
const oauthState = await window.ipc.invoke('oauth:getState', null)
if (!cancelled) setEmailConnected(oauthState.config?.google?.connected ?? false)
} catch {
if (!cancelled) setEmailConnected(false)
}
}
void check()
const cleanup = window.ipc.on('oauth:didConnect', () => { void check() })
return () => { cancelled = true; cleanup() }
const cleanupOAuthConnect = window.ipc.on('oauth:didConnect', () => { void check() })
return () => {
cancelled = true
cleanupOAuthConnect()
}
}, [])
useEffect(() => { persistedImportant = important }, [important])

View file

@ -190,7 +190,7 @@ function UpcomingEvents() {
const [loading, setLoading] = useState(true)
const [error, setError] = useState<string | null>(null)
const [refreshTick, setRefreshTick] = useState(0)
// Calendar connection status — null while checking, false shows the connect prompt.
// Calendar sync uses the native Google OAuth connection.
const [calendarConnected, setCalendarConnected] = useState<boolean | null>(null)
const [settingsOpen, setSettingsOpen] = useState(false)
@ -198,15 +198,18 @@ function UpcomingEvents() {
let cancelled = false
const check = async () => {
try {
const result = await window.ipc.invoke('composio:get-connection-status', { toolkitSlug: 'googlecalendar' })
if (!cancelled) setCalendarConnected(result.isConnected)
const oauthState = await window.ipc.invoke('oauth:getState', null)
if (!cancelled) setCalendarConnected(oauthState.config?.google?.connected ?? false)
} catch {
if (!cancelled) setCalendarConnected(false)
}
}
void check()
const cleanup = window.ipc.on('oauth:didConnect', () => { void check() })
return () => { cancelled = true; cleanup() }
const cleanupOAuthConnect = window.ipc.on('oauth:didConnect', () => { void check() })
return () => {
cancelled = true
cleanupOAuthConnect()
}
}, [])
const loadEvents = useCallback(async () => {