()
| 357 | |
| 358 | let taskQueue: Array<() => void> = [] |
| 359 | const subscribeToObserver = () => |
| 360 | observer.subscribe((result) => { |
| 361 | taskQueue.push(() => { |
| 362 | batch(() => { |
| 363 | const dataResources_ = dataResources() |
| 364 | for (let index = 0; index < dataResources_.length; index++) { |
| 365 | const dataResource = dataResources_[index]! |
| 366 | const unwrappedResult = { ...unwrap(result[index]) } |
| 367 | // @ts-expect-error typescript pedantry regarding the possible range of index |
| 368 | setState(index, unwrap(unwrappedResult)) |
| 369 | dataResource[1].mutate(() => unwrap(state[index]!.data)) |
| 370 | dataResource[1].refetch() |
| 371 | } |
| 372 | }) |
| 373 | }) |
| 374 | |
| 375 | queueMicrotask(() => { |
| 376 | const taskToRun = taskQueue.pop() |
| 377 | if (taskToRun) taskToRun() |
| 378 | taskQueue = [] |
| 379 | }) |
| 380 | }) |
| 381 | |
| 382 | let unsubscribe: () => void = noop |
| 383 | createComputed<() => void>((cleanup) => { |
no test coverage detected