All files / runtime-core/src apiComputed.ts

86.66% Statements 13/15
66.66% Branches 2/3
100% Functions 1/1
86.66% Lines 13/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 182x 2x   2x 34x 34x 34x   34x 34x 34x 34x     34x 34x 34x  
import { type ComputedRefImpl, computed as _computed } from '@vue/reactivity'
import { getCurrentInstance, isInSSRComponentSetup } from './component'
 
export const computed: typeof _computed = (
  getterOrOptions: any,
  debugOptions?: any,
) => {
  // @ts-expect-error
  const c = _computed(getterOrOptions, debugOptions, isInSSRComponentSetup)
  if (__DEV__) {
    const i = getCurrentInstance()
    if (i && i.appContext.config.warnRecursiveComputed) {
      ;(c as unknown as ComputedRefImpl<any>)._warnRecursive = true
    }
  }
  return c as any
}