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

Function createDeepSignal

packages/solid-query/src/useBaseQuery.ts:205–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203 }
204
205 function createDeepSignal<T>(): Signal<T> {
206 return [
207 () => state,
208 (v: any) => {
209 const unwrapped = unwrap(state)
210 if (typeof v === 'function') {
211 v = v(unwrapped)
212 }
213 // Hydration data exists on first load after SSR,
214 // and should be removed from the observer result
215 if (v?.hydrationData) {
216 const { hydrationData, ...rest } = v
217 v = rest
218 }
219 setStateWithReconciliation(v)
220 },
221 ] as Signal<T>
222 }
223
224 /**
225 * Unsubscribe is set lazily, so that we can subscribe after hydration when needed.

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected