()
| 270 | |
| 271 | let taskQueue: Array<() => void> = [] |
| 272 | const subscribeToObserver = () => |
| 273 | observer.subscribe((result) => { |
| 274 | taskQueue.push(() => { |
| 275 | batch(() => { |
| 276 | const dataResources_ = dataResources() |
| 277 | for (let index = 0; index < dataResources_.length; index++) { |
| 278 | const dataResource = dataResources_[index]! |
| 279 | const unwrappedResult = { ...unwrap(result[index]) } |
| 280 | // @ts-expect-error typescript pedantry regarding the possible range of index |
| 281 | setState(index, unwrap(unwrappedResult)) |
| 282 | dataResource[1].mutate(() => unwrap(state[index]!.data)) |
| 283 | dataResource[1].refetch() |
| 284 | } |
| 285 | }) |
| 286 | }) |
| 287 | |
| 288 | queueMicrotask(() => { |
| 289 | const taskToRun = taskQueue.pop() |
| 290 | if (taskToRun) taskToRun() |
| 291 | taskQueue = [] |
| 292 | }) |
| 293 | }) |
| 294 | |
| 295 | let unsubscribe: () => void = noop |
| 296 | createComputed<() => void>((cleanup) => { |
no test coverage detected