Line data Source code
1 : /**
2 : * Vue-related feature flags composable
3 : * Manages local settings-driven flags and LiteGraph integration
4 : */
5 : import { createSharedComposable } from '@vueuse/core'
6 : import { computed, watch } from 'vue'
7 :
8 : import { useSettingStore } from '@/platform/settings/settingStore'
9 :
10 : import { LiteGraph } from '@/lib/litegraph/src/litegraph'
11 :
12 2355 : function useVueFeatureFlagsIndividual() {
13 2355 : const settingStore = useSettingStore()
14 :
15 2355 : const shouldRenderVueNodes = computed(() => {
16 2458 : try {
17 2458 : return settingStore.get('Comfy.VueNodes.Enabled')
18 : } catch {
19 0 : return false
20 : }
21 : })
22 :
23 : // Watch for changes and update LiteGraph immediately
24 2355 : watch(
25 : shouldRenderVueNodes,
26 : () => {
27 2458 : LiteGraph.vueNodesMode = shouldRenderVueNodes.value
28 : },
29 : { immediate: true }
30 : )
31 :
32 2355 : return {
33 : shouldRenderVueNodes
34 : }
35 : }
36 :
37 2355 : export const useVueFeatureFlags = createSharedComposable(
38 : useVueFeatureFlagsIndividual
39 : )
|