MCPcopy Create free account
hub / github.com/effect-app/libs / resolveEnabled

Function resolveEnabled

packages/vue/src/internal/tanstackQuery.ts:71–89  ·  view source on GitHub ↗
(
  arg: I | WatchSource<I> | undefined | WatchSource<Option.Option<I>>,
  options: {
    readonly mode?: "optional" | undefined
    readonly enabled?: MaybeRefOrGetter<boolean | undefined> | undefined
  } | undefined
)

Source from the content-addressed store, hash-verified

69}
70
71const resolveEnabled = <I>(
72 arg: I | WatchSource<I> | undefined | WatchSource<Option.Option<I>>,
73 options: {
74 readonly mode?: "optional" | undefined
75 readonly enabled?: MaybeRefOrGetter<boolean | undefined> | undefined
76 } | undefined
77) => {
78 if (options?.mode === "optional") {
79 return computed(() => {
80 const option = toValue(arg)
81 return Option.isSome(option)
82 })
83 }
84 return computed(() => {
85 const enabled = options?.enabled
86 if (enabled === undefined) return true
87 return !!toValue(enabled)
88 })
89}
90
91type LegacyTanstackOptions<A, E, TData> =
92 & (

Callers 1

useQueryFunction · 0.85

Calls 1

computedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…