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

Function createDeepSignal

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

Source from the content-addressed store, hash-verified

205 }
206
207 function createDeepSignal<T>(): Signal<T> {
208 return [
209 () => state,
210 (v: any) => {
211 const unwrapped = unwrap(state)
212 if (typeof v === 'function') {
213 v = v(unwrapped)
214 }
215 // Hydration data exists on first load after SSR,
216 // and should be removed from the observer result
217 if (v?.hydrationData) {
218 const { hydrationData, ...rest } = v
219 v = rest
220 }
221 setStateWithReconciliation(v)
222 },
223 ] as Signal<T>
224 }
225
226 /**
227 * 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