fix: refactor component tree to reduce re-render propagation#471
Open
binayyub4211 wants to merge 10 commits into
Open
fix: refactor component tree to reduce re-render propagation#471binayyub4211 wants to merge 10 commits into
binayyub4211 wants to merge 10 commits into
Conversation
|
@binayyub4211 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
|
Kindly resolve conflict and fix workflow. |
…uality, notifications, and card components
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.
Closes #269
What was done
<ScreenTracker />JSX component withinapp/_layout.tsxinto a custom hookuseScreenTracker().RootLayoutContentto decrease nesting levels down to an optimized depth of 4 layers under the root.OfflineIndicatorProvider.tsxto extract stateful toast and network status tracking states into a lightweight, standalone sibling component calledOfflineUI, wrapped inReact.memo.OfflineIndicatorProviderwas made completely stateless, shielding the entire main navigation stack and child components within{children}from network or toast state changes.AnalyticsProvider.tsxanduseAuth.tsxinsideReact.useMemoto keep references stable and prevent cascading updates to consumers.Animated.springand clean Proxy-based mocks forlucide-react-nativeinsidejest.setup.jsto ensure fake timers execute correctly without infinite loops.Why it was done
Deep React component trees suffer from render cascades where high-frequency state updates (such as network connections or active alerts) trigger updates across the entire app. Isolating stateful UI branches into memoized siblings and stable contexts shields independent branches and keeps rendering focused.
How it was verified
tests/components/ComponentTreeOptimization.test.tsxverifying that mock state updates for network status transitions and toast additions cause 0 re-renders on the child component tree.useDebounce.test.tsto confirm core input timer logic passes.