Perf: typing re-renders the whole screen incl. image rows — inventory item detail (QTY/LOC) + POS search #202

Open
opened 2026-07-05 21:11:02 +00:00 by gambit-admin · 1 comment
Owner

Bug (re-render audit, milder keystroke-driven variant of the scan bug):

  1. inventory/[id].tsx — the always-mounted QTY/LOC hero TextInputs re-render the entire item-detail page on every keystroke, re-rendering the un-memoized per-RCN InstanceRow list (image + badges + a 4-cell metric grid per row) and the GradedPanel (heavy Math.max-spread compute in render body).
  2. pos.tsx — the inventory-search FlatList (up to 30 rows, each a remote image) re-renders on every NOTES / discount keystroke because renderItem/keyExtractor are inline and the row isn’t memoized.

Fix in progress (feature/josh): React.memo the rows/panels + useCallback handlers + useMemo the heavy derivations. Memoization only, no behavior change.

**Bug (re-render audit, milder keystroke-driven variant of the scan bug):** 1. `inventory/[id].tsx` — the always-mounted QTY/LOC hero TextInputs re-render the entire item-detail page on every keystroke, re-rendering the un-memoized per-RCN InstanceRow list (image + badges + a 4-cell metric grid per row) and the GradedPanel (heavy Math.max-spread compute in render body). 2. `pos.tsx` — the inventory-search FlatList (up to 30 rows, each a remote image) re-renders on every NOTES / discount keystroke because renderItem/keyExtractor are inline and the row isn’t memoized. **Fix in progress (feature/josh):** `React.memo` the rows/panels + `useCallback` handlers + `useMemo` the heavy derivations. Memoization only, no behavior change.
gambit-admin added the uiperformancein progress (design)claimed:josh labels 2026-07-05 21:11:04 +00:00
Author
Owner

Fixed: typing re-rendered the whole screen incl image rows. inventory/[id].tsx: QTY/LOC moved to a local memoized HeroMetaInput committing to refs so a keystroke re-renders only that input. pos.tsx: useCallback cart handlers, memoized CartRow + RecentSalesBox, useMemo screen options so a search keystroke re-renders only input+filter. Pure memoization, no behavior change. tsc 0. Hot-reloaded; pending on-device verify.

Fixed: typing re-rendered the whole screen incl image rows. inventory/[id].tsx: QTY/LOC moved to a local memoized HeroMetaInput committing to refs so a keystroke re-renders only that input. pos.tsx: useCallback cart handlers, memoized CartRow + RecentSalesBox, useMemo screen options so a search keystroke re-renders only input+filter. Pure memoization, no behavior change. tsc 0. Hot-reloaded; pending on-device verify.
Sign in to join this conversation.