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