Skip to content

Conversation

@joeljkrb
Copy link
Collaborator

@joeljkrb joeljkrb commented Dec 2, 2025

Improve rendering performance by memoizing expensive operations that were running on every render. These optimisations reduce unnecessary re-renders and expensive computations in list components.

Changes:

  • ValidatorList Item: Wrap component with React.memo to prevent unnecessary re-renders when props haven't changed (affects 100+ list items)
  • NominationList: Memoize JSON.stringify operation for pageKey generation
  • GenerateNominations: Memoize JSON.stringify for nominations comparison
  • ValidatorList: Memoize address array extraction to prevent unnecessary hook re-executions

Improve rendering performance by memoizing expensive operations that were
running on every render. These optimizations reduce unnecessary re-renders
and expensive computations in list components.

Changes:
- ValidatorList Item: Wrap component with React.memo to prevent unnecessary
  re-renders when props haven't changed (affects 100+ list items)
- NominationList: Memoize JSON.stringify operation for pageKey generation
- GenerateNominations: Memoize JSON.stringify for nominations comparison
- ValidatorList: Memoize address array extraction to prevent unnecessary
  hook re-executions
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces React performance optimizations through strategic use of React.memo and useMemo to reduce unnecessary re-renders and expensive computations in validator list components. The changes target components that render large lists (100+ items) and perform repeated expensive operations like JSON stringification.

Key Changes:

  • Wrapped ValidatorList Item component with React.memo to prevent re-renders when props haven't changed
  • Memoized JSON.stringify operations in NominationList and GenerateNominations to avoid redundant serialization on every render
  • Memoized address array extraction in ValidatorList to prevent unnecessary hook re-executions

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/app/src/library/ValidatorList/Item.tsx Wraps Item component with React.memo to optimize list rendering performance
packages/app/src/library/ValidatorList/index.tsx Memoizes validator address array extraction to prevent unnecessary hook calls
packages/app/src/library/NominationList/index.tsx Memoizes JSON.stringify operation for pageKey generation
packages/app/src/library/GenerateNominations/index.tsx Memoizes JSON.stringify operations for nominations comparison and updates useEffect dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Dec 4, 2025

@rossbulat I've opened a new pull request, #3129, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Dec 4, 2025

@rossbulat I've opened a new pull request, #3131, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: rossbulat <[email protected]>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

Status: ✂️ In progress

Development

Successfully merging this pull request may close these issues.

3 participants