Description
Summary
VirtualResultGrid and ResultsTab trigger multiple whole-tree rebuilds during cell selection changes and keyboard/mouse navigation.
- Rebuild cascade: On every selection step (
_jumpToCell,_selectAll, secondary tap, etc.),VirtualResultGrid.setStateis called, followed immediately by_notifySelectionAndFocus(). - Synchronous string allocations:
_notifySelectionAndFocus()iterates through the selection bounding box and allocatesList<String> valuescontaining all selected cell strings. - Double
setStateon parent:ResultsTabhooksonSelectionValuesChangedandonCellFocused. In both callbacks, it immediately callssetState(). This forcesResultsTab(including the toolbar, segmented view buttons, status line, and childVirtualResultGrid) to rebuild twice for every navigation event. - Synchronous math on UI thread:
GridSelectionCalcEngine.compute(values)runs synchronously for selections under threshold, parsing strings to doubles and calculating sum, avg, min, max, count on the main thread during navigation.
This easily breaches the 8.3ms frame budget @ 120 Hz when navigating or dragging selections in large grids.
Scope
• Decouple selection statistics display in the status bar using a ValueNotifier<GridCalcStats> or targeted sub-widget so updating stats does not rebuild the entire ResultsTab or VirtualResultGrid.
• Isolate _focusedColumnName, _focusedCellValue, and _focusedRowIndex updates from the rest of the ResultsTab chrome.
• Throttle or debounce calculation of selection aggregates during rapid navigation / drag.
• Ensure onSelectionValuesChanged does not trigger synchronous double rebuilds of the grid.
Out of scope
• Virtualization of columns or row cells.
• Asynchronous compute worker pools for large aggregations (handled by computeAdaptive).
Activity
Merge pull request #974 from QueryaHub/issue/885-grid-selection-stats…
ZhuchkaTriplesix commentedon Sep 27, 2026
Resolved by #974 (already merged into
dev; not auto-closed since this repo's default branch ismainand PRs merge intodev).