Files
gridcraft/crates
Aimar Mendez 0812d3aee5 PivotTable Fields pane: scan the source once per change, not every frame
The pane ran `pivot.fields` on every frame while the active cell was in a
PivotTable report. That command reads the whole source list and collects
distinct labels for every field, so a 250,000 x 20 source made each frame
cost ~2.4 s and the window looked frozen (#2113).

Keep the answer in GridState, keyed by (doc uid, revision, pivot), the way
Page Break Preview keeps its pages. Any undoable edit, undo or redo bumps
the revision and drops it.

Known limit: Calculate Now / Calculate Sheet don't bump the revision, so
volatile formulas in the source can leave the tooltip samples stale until
the next edit; the field list itself only changes through undoable edits.

VERIFIED
- New test pivot_fields_pane_reuses_its_field_list_until_the_workbook_changes
  fails without the change and passes with it.
- Release build, 250,000 x 20 synthetic source, pane open (ui.inspect):
  main ~2,400 ms per frame throughout; this branch 2,528 ms for the first
  frame, then 0.4-0.9 ms.
- `cargo xtask ci` passes all 8 steps on macOS with the separate clippy
  fix from #2141 applied locally (main fails clippy on macOS without it).

NOT IN THIS CHANGE
- The report is still empty after opening a file saved with
  refreshOnLoad="1" (second part of #2113).
- `pivot.fields` itself is unchanged; the first frame still pays one scan.
2026-10-21 19:03:36 +01:00
..