* @param {IContextPropUsed } used * @private * @template T, DEP
(used)
| 494 | * @template T, DEP |
| 495 | */ |
| 496 | tryUpdate_(used) { |
| 497 | // The value is not pending anymore. If any of the dependencies will remain |
| 498 | // unresolved, we will simply need to recomputed it. |
| 499 | const refreshParent = used.pending == Pending_Enum.PENDING_REFRESH_PARENT; |
| 500 | |
| 501 | let newValue; |
| 502 | try { |
| 503 | newValue = this.calc_(used, refreshParent); |
| 504 | } catch (e) { |
| 505 | // This is the narrowest catch to avoid unrelated values breaking each |
| 506 | // other. The only exposure to the user-code are `recursive` and |
| 507 | // `compute` methods in the `IContextProp`. |
| 508 | rethrowAsync(e); |
| 509 | } |
| 510 | |
| 511 | // Reset pending flag. It's good to reset it after the calculation to |
| 512 | // ensure that deps are automatically covered. |
| 513 | used.pending = Pending_Enum.NOT_PENDING; |
| 514 | |
| 515 | // Check if the value has been updated. |
| 516 | this.maybeUpdated_(used, newValue); |
| 517 | } |
| 518 | |
| 519 | /** |
| 520 | * @param {IContextPropUsed<T, ?>} used |
no test coverage detected