mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-26 12:35:35 +02:00
fix(desktop): wait for channel status to settle before returning
The listStates IPC handler now waits for any "starting" status to settle (max 3.5s) before returning, ensuring the UI always gets the final status (running/error) instead of the transient "starting" state. Also fixes unused variable lint warning in profile page. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,11 +30,22 @@ function maskToken(token: unknown): string | undefined {
|
||||
export function registerChannelsIpcHandlers(): void {
|
||||
/**
|
||||
* List all channel account states (running / stopped / error).
|
||||
* Waits for any "starting" status to settle before returning.
|
||||
*/
|
||||
ipcMain.handle('channels:listStates', async () => {
|
||||
const hub = getCurrentHub()
|
||||
if (!hub) return []
|
||||
return hub.channelManager.listAccountStates()
|
||||
|
||||
let states = hub.channelManager.listAccountStates()
|
||||
|
||||
// Wait for "starting" status to settle (max 3.5s, since internal timeout is 3s)
|
||||
const start = Date.now()
|
||||
while (states.some(s => s.status === 'starting') && Date.now() - start < 3500) {
|
||||
await new Promise(r => setTimeout(r, 100))
|
||||
states = hub.channelManager.listAccountStates()
|
||||
}
|
||||
|
||||
return states
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function ProfilePage() {
|
||||
const { providers, current, setProvider, refresh, loading: providerLoading } = useProviderStore()
|
||||
|
||||
const [profileLoading, setProfileLoading] = useState(true)
|
||||
const [saving, setSaving] = useState(false)
|
||||
const [_saving, setSaving] = useState(false)
|
||||
const [name, setName] = useState('')
|
||||
const [userContent, setUserContent] = useState('')
|
||||
const [hasChanges, setHasChanges] = useState(false)
|
||||
|
||||
Reference in New Issue
Block a user