MCPcopy Index your code
hub / github.com/TanStack/query / createServerSubscriber

Function createServerSubscriber

packages/solid-query/src/useBaseQuery.ts:148–168  ·  view source on GitHub ↗
(
    resolve: (
      data: ResourceData | PromiseLike<ResourceData | undefined> | undefined,
    ) => void,
    reject: (reason?: any) => void,
  )

Source from the content-addressed store, hash-verified

146 createStore<QueryObserverResult<TData, TError>>(observerResult)
147
148 const createServerSubscriber = (
149 resolve: (
150 data: ResourceData | PromiseLike<ResourceData | undefined> | undefined,
151 ) => void,
152 reject: (reason?: any) => void,
153 ) => {
154 return observer().subscribe((result) => {
155 notifyManager.batchCalls(() => {
156 const query = observer().getCurrentQuery()
157 const unwrappedResult = hydratableObserverResult(query, result)
158
159 if (unwrappedResult.isError) {
160 reject(unwrappedResult.error)
161 unsubscribeIfQueued()
162 } else {
163 resolve(unwrappedResult)
164 unsubscribeIfQueued()
165 }
166 })()
167 })
168 }
169
170 const unsubscribeIfQueued = () => {
171 if (unsubscribeQueued) {

Callers 1

useBaseQueryFunction · 0.85

Calls 6

hydratableObserverResultFunction · 0.85
rejectFunction · 0.85
unsubscribeIfQueuedFunction · 0.85
resolveFunction · 0.85
getCurrentQueryMethod · 0.80
subscribeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…