LCOV - code coverage report
Current view: top level - src/composables - useLiveGraphNode.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 4 4
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { useEventListener } from '@vueuse/core'
       2              : import type { ComputedRef } from 'vue'
       3              : import { computed, shallowRef } from 'vue'
       4              : 
       5              : import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
       6              : import { app } from '@/scripts/app'
       7              : 
       8              : /** The node `resolve` returns, resolved again each time the root graph is configured. */
       9          108 : export function useLiveGraphNode(
      10              :   resolve: () => LGraphNode | null | undefined
      11              : ): ComputedRef<LGraphNode | null> {
      12          108 :   const node = shallowRef(resolve() ?? null)
      13          108 :   useEventListener(
      14              :     () => app.rootGraphOrUndefined?.events,
      15              :     'configured',
      16              :     () => (node.value = resolve() ?? null)
      17              :   )
      18          108 :   return computed(() => node.value)
      19              : }
        

Generated by: LCOV version 2.0-1