Skip to content

perf(property-list): memoize property list computations - #1286

Merged
nanaf6203-bit merged 2 commits into
MettaChain:mainfrom
YaronZaki:feat/issue-1186-memoize-property-list-computations
Oct 15, 2026
Merged

nanaf6203-bit merged 2 commits into
MettaChain:mainfrom
YaronZaki:feat/issue-1186-memoize-property-list-computations

Conversation

@YaronZaki

Copy link
Copy Markdown
Contributor

Summary

Memoizes the row-chunking computation in the PropertyList component so the visible listings are sliced out of the source array once per data change rather than on every render. This removes repeated array work from a component that sits directly in the search results render path.

Problem

VirtualizedPropertyGrid derived its row count with Math.ceil and then called properties.slice(...) again for every virtual row inside the render loop. Both calculations were re-executed on each render - including renders caused by unrelated filter, sort or pagination state - even though the property array and column count had not changed.

Changes Made

  • Replaced the inline row count and per-row slicing in src/components/VirtualizedPropertyGrid.tsx with a useMemo that chunks properties into rows keyed on [properties, columns].
  • Passed
    ows.length to useVirtualizer as the row count, which is numerically identical to the previous Math.ceil result.
  • Read itemsInRow directly from the memoized
    ows array inside the virtual row map.

Implementation Details

The memoized chunk array is rebuilt only when the properties array reference or the measured column count changes, so scrolling and re-rendering now index into an existing structure. The fallback
ows[virtualRow.index] ?? [] keeps rendering safe if the virtualizer briefly reports an index beyond the current chunk list.

Closes #1186

Closes #1185

Closes #1184

Closes #1183

@drips-wave

drips-wave Bot commented Oct 15, 2026

Copy link
Copy Markdown

@YaronZaki Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nanaf6203-bit nanaf6203-bit 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.

LGTM

@nanaf6203-bit
nanaf6203-bit merged commit 4a1562d into MettaChain:main Oct 15, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants