fix: address code review - add try/catch for dynamic import and filter user keybindings

Amp-Thread-ID: https://ampcode.com/threads/T-019c17e3-96d4-754b-8a41-9257d73720f1
This commit is contained in:
bymyself
2026-01-31 22:42:26 -08:00
parent 48cdd70b5c
commit d3ce345d06
2 changed files with 15 additions and 5 deletions

View File

@@ -126,6 +126,12 @@ export function useKeybindingService() {
}
const newBindings = settingStore.get('Comfy.Keybinding.NewBindings')
for (const keybinding of newBindings) {
if (
isCloud &&
keybinding.commandId === 'Workspace.ToggleBottomPanelTab.logs-terminal'
) {
continue
}
keybindingStore.addUserKeybinding(new KeybindingImpl(keybinding))
}
}

View File

@@ -121,11 +121,15 @@ export const useBottomPanelStore = defineStore('bottomPanel', () => {
const registerCoreBottomPanelTabs = async () => {
// Use __DISTRIBUTION__ directly for proper dead code elimination
if (__DISTRIBUTION__ !== 'cloud') {
const { useLogsTerminalTab, useCommandTerminalTab } =
await import('@/composables/bottomPanelTabs/useTerminalTabs')
registerBottomPanelTab(useLogsTerminalTab())
if (isElectron()) {
registerBottomPanelTab(useCommandTerminalTab())
try {
const { useLogsTerminalTab, useCommandTerminalTab } =
await import('@/composables/bottomPanelTabs/useTerminalTabs')
registerBottomPanelTab(useLogsTerminalTab())
if (isElectron()) {
registerBottomPanelTab(useCommandTerminalTab())
}
} catch (error) {
console.error('Failed to load terminal tabs:', error)
}
}
useShortcutsTab().forEach(registerBottomPanelTab)