(node: ReactiveNode)
| 307 | * Ensure this producer's `version` is up-to-date. |
| 308 | */ |
| 309 | export function producerUpdateValueVersion(node: ReactiveNode): void { |
| 310 | if (consumerIsLive(node) && !node.dirty) { |
| 311 | // A live consumer will be marked dirty by producers, so a clean state means that its version |
| 312 | // is guaranteed to be up-to-date. |
| 313 | return; |
| 314 | } |
| 315 | |
| 316 | if (!node.dirty && node.lastCleanEpoch === epoch) { |
| 317 | // Even non-live consumers can skip polling if they previously found themselves to be clean at |
| 318 | // the current epoch, since their dependencies could not possibly have changed (such a change |
| 319 | // would've increased the epoch). |
| 320 | return; |
| 321 | } |
| 322 | |
| 323 | if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) { |
| 324 | // None of our producers report a change since the last time they were read, so no |
| 325 | // recomputation of our value is necessary, and we can consider ourselves clean. |
| 326 | producerMarkClean(node); |
| 327 | return; |
| 328 | } |
| 329 | |
| 330 | node.producerRecomputeValue(node); |
| 331 | |
| 332 | // After recomputing the value, we're no longer dirty. |
| 333 | producerMarkClean(node); |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Propagate a dirty notification to live consumers of this producer. |
no test coverage detected
searching dependent graphs…