* The callback called by the `ContextNode` to notify values of the context * root changes. It's possible that a context node is connected, disconnected, * or moved to another root. This callback schedules recalculations if * necessary. * * @package
()
| 261 | * @package |
| 262 | */ |
| 263 | rootUpdated() { |
| 264 | const usedByKey = this.usedByKey_; |
| 265 | if (!usedByKey) { |
| 266 | return; |
| 267 | } |
| 268 | if (this.isConnected_()) { |
| 269 | // Ping all properties for recalculation when the tree is connected. |
| 270 | usedByKey.forEach((used) => { |
| 271 | const {prop} = used; |
| 272 | this.ping(prop, true); |
| 273 | }); |
| 274 | } else { |
| 275 | // On disconnect, only do minimal possible work: disconnect recursive |
| 276 | // subscribers to ensure that they are not leaked. |
| 277 | usedByKey.forEach((used) => { |
| 278 | const {prop} = used; |
| 279 | if (isRecursive(prop)) { |
| 280 | this.updateParentContextNode_(used, null); |
| 281 | } |
| 282 | }); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Used for `deepScan` scanner to notify the subtree that the specified |
no test coverage detected