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