* Check if any properties awaiting recalculation. This method is always * scheduled asynchronously and throttled. * * @private
()
| 450 | * @private |
| 451 | */ |
| 452 | checkUpdates_() { |
| 453 | if (!this.isConnected_()) { |
| 454 | // The node got disconnected between scheduling and handling. |
| 455 | return; |
| 456 | } |
| 457 | |
| 458 | const usedByKey = this.usedByKey_; |
| 459 | if (!usedByKey) { |
| 460 | return; |
| 461 | } |
| 462 | |
| 463 | usedByKey.forEach((used) => { |
| 464 | used.counter = 0; |
| 465 | }); |
| 466 | |
| 467 | // Recompute all "pinged" values for this node. It checks if dependencies |
| 468 | // are satisfied and recomputes values accordingly. |
| 469 | /** @type {number?} */ |
| 470 | let updated; |
| 471 | do { |
| 472 | updated = 0; |
| 473 | usedByKey.forEach((used) => { |
| 474 | if (used.pending != Pending_Enum.NOT_PENDING) { |
| 475 | const {key} = used.prop; |
| 476 | used.counter++; |
| 477 | if (used.counter > 5) { |
| 478 | // A simple protection from infinite loops. |
| 479 | rethrowAsync(`cyclical prop: ${key}`); |
| 480 | used.pending = Pending_Enum.NOT_PENDING; |
| 481 | return; |
| 482 | } |
| 483 | devAssertNumber(updated); |
| 484 | updated++; |
| 485 | this.tryUpdate_(used); |
| 486 | } |
| 487 | }); |
| 488 | } while (updated > 0); |
| 489 | } |
| 490 | |
| 491 | /** |
| 492 | * @param {IContextPropUsed<T, DEP>} used |
no test coverage detected