perf: memoize VaultTransactions filtering, windowing, and totals#523
Open
DevALVIN-24 wants to merge 1 commit into
Open
perf: memoize VaultTransactions filtering, windowing, and totals#523DevALVIN-24 wants to merge 1 commit into
DevALVIN-24 wants to merge 1 commit into
Conversation
|
@DevALVIN-24 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! 🚀 |
Contributor
Author
|
okay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pr closes #505
Description:
This PR addresses the performance issue in
src/pages/VaultTransactions.tsxwhere derived state—specifically the filtered status arrays (pending,failed,rest), their respective window slices, and transaction totals—were recomputed on every render. This caused intensive array methods to run even when interacting with unrelated local state (like copying hashes, or opening the detail modal).Changes Included:
src/pages/VaultTransactions.tsx):pending,failed, andrestarrays inuseMemoso they only recalculate when the actively visiblefilteredlist changes.pendingWindow,failedWindow,restWindow) inuseMemoso they only recalculate when their respective status list oranchorIndexchanges.src/pages/__tests__/VaultTransactions.test.tsx):vi.spyOnagainst thewindowRangeandcomputeTxTotalsmodules to verify that derivations do NOT re-run during unrelated state changes (like opening the transaction detail modal) but DO re-run when filters are actively changed.contentinadvertently appeared multiple times, and resolved awindow.matchMediarendering crash in the test suite setup.docs/PERFORMANCE.md):Component Rendering Optimizationsection documenting the strategy implemented in theVaultTransactionscomponent.Verification:
The push to your remote repository was successful! Let me know if you need any additional changes to this implementation or if there is anything else I can help you with.