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

Method syncClient

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

Source from the content-addressed store, hash-verified

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