Add default toast error handling for command execution (#1106)

* Error handling execute command

* Cleanup

* Add playwright test

* Mock i18n in jest test

* Reduce test func timeout
This commit is contained in:
Chenlei Hu
2024-10-04 16:28:08 -04:00
committed by GitHub
parent ebc71b0e46
commit 57a4cb9036
13 changed files with 126 additions and 44 deletions

View File

@@ -20,7 +20,7 @@
severity="secondary"
icon="pi pi-expand"
v-tooltip.left="t('graphCanvasMenu.resetView')"
@click="() => commandStore.getCommandFunction('Comfy.Canvas.ResetView')()"
@click="() => commandStore.execute('Comfy.Canvas.ResetView')"
/>
<Button
severity="secondary"
@@ -29,9 +29,7 @@
'graphCanvasMenu.' + (canvasStore.readOnly ? 'panMode' : 'selectMode')
) + ' (Space)'
"
@click="
() => commandStore.getCommandFunction('Comfy.Canvas.ToggleLock')()
"
@click="() => commandStore.execute('Comfy.Canvas.ToggleLock')"
>
<template #icon>
<i-material-symbols:pan-tool-outline v-if="canvasStore.readOnly" />
@@ -42,10 +40,7 @@
severity="secondary"
:icon="linkHidden ? 'pi pi-eye-slash' : 'pi pi-eye'"
v-tooltip.left="t('graphCanvasMenu.toggleLinkVisibility')"
@click="
() =>
commandStore.getCommandFunction('Comfy.Canvas.ToggleLinkVisibility')()
"
@click="() => commandStore.execute('Comfy.Canvas.ToggleLinkVisibility')"
data-testid="toggle-link-visibility-button"
/>
</ButtonGroup>
@@ -73,7 +68,7 @@ const linkHidden = computed(
let interval: number | null = null
const repeat = (command: string) => {
if (interval) return
const cmd = commandStore.getCommandFunction(command)
const cmd = () => commandStore.execute(command)
cmd()
interval = window.setInterval(cmd, 100)
}