MCPcopy
hub / github.com/TanStack/query / run

Function run

packages/vue-query/src/useBaseQuery.ts:154–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152 // noop
153 }
154 const run = () => {
155 if (defaultedOptions.value.enabled !== false) {
156 // fix #6133
157 observer.setOptions(defaultedOptions.value)
158 const optimisticResult = observer.getOptimisticResult(
159 defaultedOptions.value,
160 )
161 if (optimisticResult.isStale) {
162 stopWatch()
163 observer
164 .fetchOptimistic(defaultedOptions.value)
165 .then(resolve, (error: TError) => {
166 if (
167 shouldThrowError(defaultedOptions.value.throwOnError, [
168 error,
169 observer.getCurrentQuery(),
170 ])
171 ) {
172 reject(error)
173 } else {
174 resolve(observer.getCurrentResult())
175 }
176 })
177 } else {
178 stopWatch()
179 resolve(optimisticResult)
180 }
181 }
182 }
183
184 run()
185

Callers 1

suspenseFunction · 0.70

Calls 9

shouldThrowErrorFunction · 0.90
stopWatchFunction · 0.85
rejectFunction · 0.85
resolveFunction · 0.85
fetchOptimisticMethod · 0.80
getCurrentQueryMethod · 0.80
setOptionsMethod · 0.45
getOptimisticResultMethod · 0.45
getCurrentResultMethod · 0.45

Tested by

no test coverage detected