Commit 7f25c46
committed
refactor(datagrid): merge sortCache into coordinator.querySortCache
The view-side @State sortCache (in MainEditorContentView) and the coordinator's @ObservationIgnored querySortCache stored byte-identical SortedRowsCache / QuerySortCacheEntry structs keyed by tab ID. Two write paths fed them: sync inline sort (small tables, ≤1000 rows) wrote to the view-side cache; async background sort (large tables) wrote to the coordinator-side cache. The read in sortedIDsForTab checked both.
The split was historical, not architectural. Both caches share the same lifecycle (window/coordinator) and the row-mutation invalidations in MainContentCoordinator+RowOperations only cleared querySortCache — meaning a sync-sorted small table would silently return a stale sortedIDs after add/delete/undo. Bug fixed as a side effect of the merge.
Drops:
- private struct SortedRowsCache
- @State var sortCache from MainEditorContentView
- The two-step cache cleanup in onChange(of: tabStructureVersion) and onTeardown
- The sortCache lookup branch in sortedIDsForTab
The sync sort path now writes directly to coordinator.querySortCache. cleanupSortCache and the row-mutation invalidations cover both paths uniformly. -23 LOC.1 parent aa4a260 commit 7f25c46
1 file changed
Lines changed: 2 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 13 | | |
25 | 14 | | |
26 | 15 | | |
| |||
58 | 47 | | |
59 | 48 | | |
60 | 49 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 50 | | |
66 | 51 | | |
67 | 52 | | |
| |||
118 | 103 | | |
119 | 104 | | |
120 | 105 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 106 | + | |
129 | 107 | | |
130 | 108 | | |
131 | 109 | | |
| |||
140 | 118 | | |
141 | 119 | | |
142 | 120 | | |
143 | | - | |
144 | 121 | | |
145 | 122 | | |
146 | 123 | | |
| |||
636 | 613 | | |
637 | 614 | | |
638 | 615 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | 616 | | |
648 | 617 | | |
649 | 618 | | |
| |||
666 | 635 | | |
667 | 636 | | |
668 | 637 | | |
669 | | - | |
| 638 | + | |
670 | 639 | | |
671 | 640 | | |
672 | 641 | | |
| |||
0 commit comments