* 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
()
| 428 | * of the new one. |
| 429 | */ |
| 430 | private async debounceSync() { |
| 431 | const debouncer = untracked(() => { |
| 432 | this.pendingSync()?.abort(); |
| 433 | return this.nodeState.debouncer(); |
| 434 | }); |
| 435 | |
| 436 | if (debouncer) { |
| 437 | const controller = new AbortController(); |
| 438 | const promise = debouncer(controller.signal); |
| 439 | if (promise) { |
| 440 | this.pendingSync.set(controller); |
| 441 | await promise; |
| 442 | if (controller.signal.aborted) { |
| 443 | return; // Do not sync if the debounce was aborted. |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | if (this.structure.isOrphaned()) { |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | this.sync(); |
| 453 | } |
| 454 | |
| 455 | /** |
| 456 | * Creates a new root field node for a new form. |
no test coverage detected