layer5 icon indicating copy to clipboard operation
layer5 copied to clipboard

fix(smi-table): optimize row rendering with memoized rows

Open Manishnemade12 opened this issue 7 months ago • 8 comments

Summary

This PR resolves the SMI table rendering performance issue by isolating row rendering and collapse state per row.

Closes : #7613

What changed

  • Refactored table row rendering from inline mapping into a separate TableRow component in src/components/SMI-Table/index.js.
  • Wrapped TableRow with React.memo() to reduce unnecessary row re-renders.
  • Moved collapse state from parent-level array to per-row local state (useState(false)) inside TableRow.
  • Kept existing visual behavior, data display, and tooltip rendering logic unchanged.

Why this improves performance

  • Clicking one row now updates only that row's local state instead of mutating a parent-level collapse array.
  • This avoids forcing a full table body re-render on each row toggle and improves interaction responsiveness for larger datasets.

Scope

  • Single-file, surgical change:
    • src/components/SMI-Table/index.js
  • No unrelated logic or styling changes.

Validation

  • Verified no diagnostics reported for the changed file in editor checks.
  • As requested, no tests were run.

Manishnemade12 avatar Apr 11 '26 03:04 Manishnemade12

@rishiraj38 Can you please review this pr

Manishnemade12 avatar Apr 11 '26 16:04 Manishnemade12

@rishiraj38 following changes i did as per your suggestion

  • Added one shared tooltip ID constant and pointed all tooltip triggers (mesh icon + pass/half/fail cells) to it.
  • Removed per-row Tooltip rendering from TableRow to prevent DOM bloat.
  • Rendered a single Tooltip once at the Table level so all row/cell tooltips resolve consistently.

Manishnemade12 avatar Apr 11 '26 18:04 Manishnemade12

@Manishnemade12 did you get any input from today meeting?

saurabhraghuvanshii avatar Apr 20 '26 17:04 saurabhraghuvanshii

@saurabhraghuvanshii i addressed your all comments , please take review once

Manishnemade12 avatar Apr 20 '26 19:04 Manishnemade12

Preview deployment for PR #7618 removed.

This PR preview was automatically pruned because we keep only the 6 most recently updated previews on GitHub Pages to stay within deployment size limits.

If needed, push a new commit to this PR to generate a fresh preview.

github-actions[bot] avatar Apr 21 '26 11:04 github-actions[bot]

@Manishnemade12 Please address all comments.

saurabhraghuvanshii avatar Apr 23 '26 07:04 saurabhraghuvanshii

@saurabhraghuvanshii i addressed all comments . can you please review it now

Manishnemade12 avatar Apr 23 '26 08:04 Manishnemade12

@Manishnemade12 LGTM. Could you please verify that your changes are working as expected? if possible attach a video

saurabhraghuvanshii avatar Apr 23 '26 08:04 saurabhraghuvanshii