mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 14:54:37 +00:00
refactor: simplify preview state provider
- Remove unnecessary event listeners and manual syncing - Use computed() to directly reference app.nodePreviewImages - Eliminate data duplication and any types - Rely on Vue's reactivity for automatic updates - Follow established patterns from execution state provider
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { computed, provide } from 'vue'
|
||||
|
||||
import { NodePreviewImagesKey } from '@/renderer/core/canvas/injectionKeys'
|
||||
import { app } from '@/scripts/app'
|
||||
|
||||
export const usePreviewStateProvider = () => {
|
||||
// Provide reactive access to app.nodePreviewImages
|
||||
// No need to duplicate data - app.nodePreviewImages is already reactive to changes
|
||||
const nodePreviewImages = computed(() => app.nodePreviewImages)
|
||||
|
||||
provide(NodePreviewImagesKey, nodePreviewImages)
|
||||
|
||||
return { nodePreviewImages }
|
||||
}
|
||||
Reference in New Issue
Block a user