()
| 271 | * @internal |
| 272 | */ |
| 273 | export function endBatch(): void { |
| 274 | if (--batchDepth > 0) { |
| 275 | return |
| 276 | } |
| 277 | |
| 278 | if (batchedComputed) { |
| 279 | let e: Subscriber | undefined = batchedComputed |
| 280 | batchedComputed = undefined |
| 281 | while (e) { |
| 282 | const next: Subscriber | undefined = e.next |
| 283 | e.next = undefined |
| 284 | e.flags &= ~EffectFlags.NOTIFIED |
| 285 | e = next |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | let error: unknown |
| 290 | while (batchedSub) { |
| 291 | let e: Subscriber | undefined = batchedSub |
| 292 | batchedSub = undefined |
| 293 | while (e) { |
| 294 | const next: Subscriber | undefined = e.next |
| 295 | e.next = undefined |
| 296 | e.flags &= ~EffectFlags.NOTIFIED |
| 297 | if (e.flags & EffectFlags.ACTIVE) { |
| 298 | try { |
| 299 | // ACTIVE flag is effect-only |
| 300 | ;(e as ReactiveEffect).trigger() |
| 301 | } catch (err) { |
| 302 | if (!error) error = err |
| 303 | } |
| 304 | } |
| 305 | e = next |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | if (error) throw error |
| 310 | } |
| 311 | |
| 312 | function prepareDeps(sub: Subscriber) { |
| 313 | // Prepare deps for tracking, starting from the head |
no test coverage detected