Repository navigation
perf: cut cascading re-renders from global state updates - #659
Open
Akatenvictor wants to merge 1 commit into
Open
Akatenvictor wants to merge 1 commit into
Akatenvictor wants to merge 1 commit into
Conversation
Global context updates were re-rendering far more of the tree than needed:
- useToast returned a fresh object every render and ErrorProvider wrapped
it in a fresh `{ toast }`, so every useErrorHandler() consumer re-rendered
whenever ErrorProvider did. Both values are now memoized.
- OwnConnectButtonContext shared one `{ count, update }` object, so every
page that only signals its CTA re-rendered on each count change. Count
and the stable updater now live in separate contexts.
- StellarWalletProvider gains a StellarWalletActionsContext exposing the
stable connect/disconnect, read via the new useStellarWalletActions()
hook; Navbar's WalletMenu uses it so it no longer re-renders when only
the network changes.
- AppShell chrome that does not depend on wallet state (Footer, SkipLink,
RefetchIndicator, OfflineBanner, RpcUnreachableBanner) is wrapped in
memo so wallet / own-CTA changes don't re-render it.
- Navbar leaf components (Logo, NavLink, MoreMenu, StatPill, WalletMenu)
are memoized, and WalletMenu's copy handler is a useCallback.
- Farm page deposit handlers are useCallback so memoized FarmPoolRow
children get stable props; the home page's animated AmbientBackground /
GradientOrb and history's HistoryCard are memoized.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
❌ Deploy Preview for smart-drop failed.
|
|
@Akatenvictor 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! 🚀 |
❌ Deploy Preview for spiffy-melomakarona-eb1e8a failed.
|
This branch has not been deployed
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.
Global context updates were re-rendering far more of the tree than needed:
{ toast }, so every useErrorHandler() consumer re-rendered whenever ErrorProvider did. Both values are now memoized.{ count, update }object, so every page that only signals its CTA re-rendered on each count change. Count and the stable updater now live in separate contexts.Closes #624
Closes #626
Closes #627
Closes #625