Fix double trigger of loadColorPalette effect (#2118)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2025-01-01 19:27:22 -05:00
committed by GitHub
parent 3d2b9a8d9d
commit 39e9f421f4
9 changed files with 34 additions and 16 deletions

View File

@@ -223,11 +223,21 @@ watch(
)
const colorPaletteService = useColorPaletteService()
watchEffect(() => {
if (!canvasStore.canvas) return
const colorPaletteStore = useColorPaletteStore()
watch(
[() => canvasStore.canvas, () => settingStore.get('Comfy.ColorPalette')],
([canvas, currentPaletteId]) => {
if (!canvas) return
colorPaletteService.loadColorPalette(settingStore.get('Comfy.ColorPalette'))
})
colorPaletteService.loadColorPalette(currentPaletteId)
}
)
watch(
() => colorPaletteStore.activePaletteId,
(newValue) => {
settingStore.set('Comfy.ColorPalette', newValue)
}
)
const workflowStore = useWorkflowStore()
const persistCurrentWorkflow = () => {
@@ -343,7 +353,6 @@ onMounted(async () => {
comfyAppReady.value = true
// Load color palette
const colorPaletteStore = useColorPaletteStore()
colorPaletteStore.customPalettes = settingStore.get(
'Comfy.CustomColorPalettes'
)