mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(servers): open settings tabs with history and keep server selection on load errors
External settings openers push a history entry and close the mobile sheet. The sidebar server selection only falls back to Local after the server list loads successfully.
This commit is contained in:
1 parent
96e22dfa66
commit
42dd733378
15 files changed
+118
-30
No files matched your search
@@ -12,7 +12,7 @@ export const OPENCODE_FAILURE_TOAST_ID = 'opencode-server-failure'
|
||||
*/
|
||||
export function useOpenCodeFailureToast(enabled: boolean, onRestart: () => void) {
|
||||
const { data: health } = useServerHealth(enabled)
|
||||
const { setActiveTab } = useSettingsDialog()
|
||||
const { openTab } = useSettingsDialog()
|
||||
const notifiedFailureRef = useRef<string | null>(null)
|
||||
|
||||
const issue = getOpenCodeServerIssue(health)
|
||||
@@ -27,7 +27,7 @@ export function useOpenCodeFailureToast(enabled: boolean, onRestart: () => void)
|
||||
id: OPENCODE_FAILURE_TOAST_ID,
|
||||
duration: Infinity,
|
||||
description: failureMessage,
|
||||
action: { label: 'View logs', onClick: () => setActiveTab('logs') },
|
||||
action: { label: 'View logs', onClick: () => openTab('logs') },
|
||||
cancel: { label: 'Restart', onClick: onRestart },
|
||||
})
|
||||
return
|
||||
@@ -38,5 +38,5 @@ export function useOpenCodeFailureToast(enabled: boolean, onRestart: () => void)
|
||||
showToast.dismiss(OPENCODE_FAILURE_TOAST_ID)
|
||||
showToast.success('OpenCode server is back online')
|
||||
}
|
||||
}, [failureMessage, isHealthy, setActiveTab, onRestart])
|
||||
}, [failureMessage, isHealthy, openTab, onRestart])
|
||||
}
|
||||
Reference in new issue
Block a user