Commit 2b9c05f
fix: defer setSelectedCellAndRange until sheet layout is ready (#9373)
<!-- Why -->
Follow-up to #9333. The connector's `setSelectedCellAndRange` silently
dropped calls when the sheet widget's `definedRowHeights` wasn't yet
populated, on the assumption that Flow would reissue the call. That
assumption only holds for the reload cycle path (`initialSheetSelection`
set on the server, then `onSheetScroll` from the client triggering
`reloadCurrentSelection`). For any other path — most notably the
selection RPC sent when the user types a range into the address field —
there is no reissue, so a call that loses the race against GWT's
deferred initial relayout is lost permanently.
This caused the cherry-pick PRs (#9365, #9366, #9367) to consistently
fail 20 selection-related tests (`NavigationIT`, `NamedRangeIT`,
`ChartsIT`, `SheetTabSheetIT`, `PreserveOnRefreshIT`, and the new
`SpreadsheetDialogIT`). The original PR happened to pass on main's CI
agent timing, but the failure is deterministic on the cherry-pick
branches' GWT 2.9 / older-Flow-SNAPSHOT environment.
<!-- Changes -->
Queue the latest call as `_pendingSelection` and poll
`definedRowHeights` every 10 ms until it's set or the element is
disconnected. Rapid successive calls collapse to the final selection
(the array is overwritten, only one retry loop runs at a time).
Follow-up to #9333.
---
🤖 Generated with Claude Code
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ef7ccb8 commit 2b9c05f
1 file changed
Lines changed: 28 additions & 5 deletions
File tree
- vaadin-spreadsheet-flow-parent/vaadin-spreadsheet-flow/src/main/resources/META-INF/resources/frontend/vaadin-spreadsheet
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
374 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
375 | 397 | | |
376 | 398 | | |
| 399 | + | |
377 | 400 | | |
378 | 401 | | |
379 | 402 | | |
| |||
0 commit comments