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

            Line data    Source code
       1              : import { useImage } from '@vueuse/core'
       2              : 
       3              : /**
       4              :  * `useImage()` that handles load failures quietly.
       5              :  *
       6              :  * `useImage()` already surfaces failures via its returned `error` ref (callers
       7              :  * render a fallback). By default vueuse ALSO forwards the error to
       8              :  * `globalThis.reportError`, which our error monitoring (Datadog RUM) captures as
       9              :  * an unhandled error for every broken image — 404'd thumbnails, expired share
      10              :  * links, in-app browsers that re-fetch in a loop. Broken images are expected,
      11              :  * not bugs, so handle the failure here instead of letting it surface globally.
      12              :  * The returned `error` ref behaviour is unchanged.
      13              :  *
      14              :  * `asyncStateOptions` is forwarded to `useImage`, so callers can still tune the
      15              :  * other `useAsyncState` fields; only `onError` is fixed to the quiet default.
      16              :  */
      17          185 : export function useImageQuiet(
      18              :   options: Parameters<typeof useImage>[0],
      19              :   asyncStateOptions?: Parameters<typeof useImage>[1]
      20              : ) {
      21          185 :   return useImage(options, {
      22              :     ...asyncStateOptions,
      23              :     onError: () => {
      24              :       // Surfaced via the returned `error` ref; see the doc comment above.
      25              :     }
      26              :   })
      27              : }
        

Generated by: LCOV version 2.0-1