Skip to content

perf: memoize the heavy transformer in the transactions table - #1037

Open
waterWang wants to merge 1 commit into
CredenceOrg:mainfrom
waterWang:perf/948-memoize-table-transformer
Open

perf: memoize the heavy transformer in the transactions table#1037
waterWang wants to merge 1 commit into
CredenceOrg:mainfrom
waterWang:perf/948-memoize-table-transformer

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Closes #948

Summary

Pre-computes formatted display values (amount, relative time, status badge variant, truncated hash) in a useMemo so that expensive operations such as toLocaleString, Date arithmetic, and i18n lookups run only when the source data or filter changes, not on every render.

Changes

  • Added a TableRow interface extending Transaction with pre-computed display fields
  • Added a useMemo that transforms filtered data into tableRows with pre-formatted values
  • Updated the table body to iterate over tableRows instead of filtered and read pre-computed values

Pre-compute formatted display values (amount, relative time, status
badge variant, truncated hash) in a useMemo so that expensive
operations such as toLocaleString, Date arithmetic, and i18n lookups
run only when the source data or filter changes, not on every render.

Closes CredenceOrg#948
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.

Perf: memoize the heavy transformer in the table

1 participant