Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

fix(alerts): memoize selecting alerts #231

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

alex-mcgovern
Copy link
Contributor

@alex-mcgovern alex-mcgovern commented Jan 30, 2025

The select function will only re-run if:

  • the select function itself changed referentially
  • data changed
    This means that an inlined select function, as shown above, will run on every render. To avoid this, you can wrap the select function in useCallback, or extract it to a stable function reference if it doesn't have any dependencies
  • This fixes any usage errors throughout the codebase (mainly created by me :D) and documents them, to attempt to avoid any regressions.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 13048707362

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 72.56%

Totals Coverage Status
Change from base Build 13036009495: -0.02%
Covered Lines: 785
Relevant Lines: 1019

💛 - Coveralls

@alex-mcgovern alex-mcgovern merged commit f810e2b into main Jan 30, 2025
8 of 9 checks passed
@alex-mcgovern alex-mcgovern deleted the fix/alerts/memoize-select-of-queried-alerts branch January 30, 2025 09:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants