* Initiates a debounced sync. * * If a debouncer is configured, the synchronization will occur after the debouncer resolves. If * no debouncer is configured, the synchronization happens immediately. If controlValue is * updated again while a debounce is pending, the previ
()
| 433 | * of the new one. |
| 434 | */ |
| 435 | private async debounceSync() { |
| 436 | const debouncer = untracked(() => { |
| 437 | this.pendingSync()?.abort(); |
| 438 | return this.nodeState.debouncer(); |
| 439 | }); |
| 440 | |
| 441 | if (debouncer) { |
| 442 | const controller = new AbortController(); |
| 443 | const promise = debouncer(controller.signal); |
| 444 | if (promise) { |
| 445 | this.pendingSync.set(controller); |
| 446 | await promise; |
| 447 | if (controller.signal.aborted) { |
| 448 | return; // Do not sync if the debounce was aborted. |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | if (this.structure.isOrphaned()) { |
| 454 | return; |
| 455 | } |
| 456 | |
| 457 | this.sync(); |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * Creates a new root field node for a new form. |
no test coverage detected