AG Grid Refactor
Status: Phases 1-3 and Visual fixes complete. Phases 4-5 and data integrity fixes pending.
Created: 2026-02-23
Repository: arda-frontend-app
Restore normal AG Grid behavior throughout the application by eliminating racing state, memory leaks, and visual glitches in the existing data grid components.
What Was Completed
Section titled “What Was Completed”Phase 1 — Stop the Bleeding (complete)
Section titled “Phase 1 — Stop the Bleeding (complete)”Eliminated active runtime bugs:
- Removed
exportDataAsExcelcall that caused runtime crashes (Enterprise API not registered). - Added
destroy()to 5 select editors and BreadcrumbSize that were leaking focus listeners on every cell edit. - Fixed deprecated API warnings appearing on every grid mount.
Phase 2 — State Ownership (complete)
Section titled “Phase 2 — State Ownership (complete)”Resolved the core state management problem where multiple code paths competed to write the same data:
- Unified column persistence to a single owner (
enableColumnStatePersistence={false}on secondary locations). Eliminated racing writes to localStorage. - Unified column visibility to a single source of truth. Removed
hidefrombaseColumnDefsto eliminate flicker and View dropdown bugs. - Removed redundant
setTimeoutsave calls. - Memoized column definitions to eliminate redundant localStorage reads on re-render.
Phase 3 — Selection and Rendering Performance (complete)
Section titled “Phase 3 — Selection and Rendering Performance (complete)”- Replaced N-event select-all with
api.setNodesSelected(single batch call). - Moved
lastSelectedRowIndexfrom module-level variable (shared across grid instances) to instance ref. - Replaced inline
cellRendererlambdas on text columns withvalueFormatterto avoid mounting React components per cell.
Visual Fixes (complete)
Section titled “Visual Fixes (complete)”- Extended row borders on horizontal scroll.
- Fixed dropdown editor popup styling, inline editing border, and change listener.
Data Integrity — Skip-Publish Gap (complete)
Section titled “Data Integrity — Skip-Publish Gap (complete)”- Fixed skip-publish gap where a quick-action click on a dirty row left the row stranded without a publish.
What Remains
Section titled “What Remains”Phase 4 — Edit-Refresh-Flicker Loop
Section titled “Phase 4 — Edit-Refresh-Flicker Loop”- Switch Notes field updates from direct
rowDatamutation toapplyTransaction. - Debounce
onRefreshRequestedto stop full table reloads after every single cell edit. - Replace 20-retry polling loop for selection restore with
onFirstDataRendered.
Phase 5 — Code Reduction
Section titled “Phase 5 — Code Reduction”- Unify the field-to-viewKey mapping that is currently written 4 times with inconsistencies.
- Replace silently-ignored
headerStyleprop withheaderClass. - Fix click-outside listener to use React ref instead of
document.querySelector(which targets the wrong grid when multiple grids exist).
Data Integrity (high priority)
Section titled “Data Integrity (high priority)”- Fix 5 bugs in
publishRowthat can silently drop user edits (stale snapshot, early dirty delete, silent block, early draft clear, double setTimeout).
Clean Patterns
Section titled “Clean Patterns”- Replace 5 custom select editors with
agSelectCellEditor. - Remove
display: noneon sort indicators to restore visible sort. - Switch content columns from fixed
widthtoflex: 1+minWidth. - Change
getRowIdto use stableid/eId(notentityId).
Related Articles
Section titled “Related Articles”Copyright: © Arda Systems 2025-2026, All rights reserved