MCPcopy Create free account
hub / github.com/TanStack/query / syncClient

Method syncClient

packages/lit-query/src/createQueryController.ts:228–249  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226 }
227
228 private syncClient(): boolean {
229 const nextClient = this.tryGetQueryClient()
230 if (!nextClient) {
231 this.unsubscribeObserver()
232 this.queryClient = undefined
233 this.observer = undefined
234 this.resultTracker.reset()
235 this.setResult(createPendingQueryResult())
236 return false
237 }
238
239 if (nextClient === this.queryClient && this.observer) {
240 return true
241 }
242
243 this.unsubscribeObserver()
244 this.queryClient = nextClient
245 const options = this.defaultOptions()
246 this.observer = new QueryObserver(this.queryClient, options)
247 this.setObserverResult(this.observer.getOptimisticResult(options))
248 return true
249 }
250
251 private applyOptions(): boolean {
252 if (!this.syncClient() || !this.observer) {

Callers 5

onConnectedMethod · 0.95
onDisconnectedMethod · 0.95
onQueryClientChangedMethod · 0.95
QueryControllerClass · 0.95
applyOptionsMethod · 0.95

Calls 6

unsubscribeObserverMethod · 0.95
defaultOptionsMethod · 0.95
setObserverResultMethod · 0.95
createPendingQueryResultFunction · 0.85
resetMethod · 0.45
getOptimisticResultMethod · 0.45

Tested by

no test coverage detected