Skip to content

perf: memoize derived values and stabilize callbacks in Landing and R… - #571

Open
LockedTerminal wants to merge 1 commit into
Heliobond:mainfrom
LockedTerminal:perf/memoize-landing-registry
Open

perf: memoize derived values and stabilize callbacks in Landing and R…#571
LockedTerminal wants to merge 1 commit into
Heliobond:mainfrom
LockedTerminal:perf/memoize-landing-registry

Conversation

@LockedTerminal

Copy link
Copy Markdown

…egistryTable

  • Landing: move STEPS to module-level const; wrap intensity computation and verify-rows array in useMemo so they are only recomputed when pool data or the translation function changes
  • RegistryTable: wrap toggleSort, handleEdit, handleCancel, handleSave in useCallback; hoist all translated labels into a single useMemo block; wrap Th and Row sub-components in React.memo so sort-triggered parent re-renders do not cascade to unchanged rows/headers
  • Row now accepts onEdit(id) / onSave(id, credit, green) signatures so the parent can pass stable handlers without per-row closures; open() and handleSave inside Row are stabilised with useCallback

Closes #388

Summary

Linked issue

Closes #

Type of change

  • Bug fix
  • Feature
  • Localization (i18n)
  • Accessibility
  • Smart contract / on-chain wiring
  • Docs / chore

Screenshots / screencast

Checklist

  • Tied to an accepted issue (Closes #…)
  • bun run build passes locally (builds + type-checks)
  • Follows the design system — token CSS vars, sentence case, mono numerals, deltas carry sign + arrow, no emoji, no hardcoded colours
  • User-facing strings added to both messages/en.json and messages/fr.json (if any copy changed)
  • Accessible — keyboard operable, visible focus, reduced-motion respected
  • No secrets committed
  • Docs updated where relevant

closes #388

…egistryTable

- Landing: move STEPS to module-level const; wrap intensity computation and
  verify-rows array in useMemo so they are only recomputed when pool data or
  the translation function changes
- RegistryTable: wrap toggleSort, handleEdit, handleCancel, handleSave in
  useCallback; hoist all translated labels into a single useMemo block;
  wrap Th and Row sub-components in React.memo so sort-triggered parent
  re-renders do not cascade to unchanged rows/headers
- Row now accepts onEdit(id) / onSave(id, credit, green) signatures so the
  parent can pass stable handlers without per-row closures; open() and
  handleSave inside Row are stabilised with useCallback

Closes Heliobond#388
@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

@LockedTerminal is attempting to deploy a commit to the David Dada's projects Team on Vercel.

A member of the Team first needs to authorize it.

@sshdopey sshdopey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this performance pass! Moving STEPS to a module constant and memoizing the intensity and verify rows in Landing are solid wins. In RegistryTable, wrapping handlers in useCallback and memoizing Th and Row should cut down on needless re-renders nicely. The refactor to pass row ids to stable callbacks is a clean pattern. Thanks for tackling #388 — this looks like a thoughtful, well-scoped improvement. Keep it up! ❤️

@sshdopey

sshdopey commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Approved! 🎉 I couldn't auto-merge this just yet (it may need a rebase or have a check still running). A maintainer can merge it whenever it's ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memoize derived computations in hot render paths

2 participants