-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance improvements #6376
Performance improvements #6376
Conversation
Now when the data changes, search results will always update — fixes a bug where results would occasionally be empty if data only became available after initial mount
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@shopify/[email protected], npm/@tanstack/[email protected], npm/[email protected], npm/[email protected], npm/[email protected] |
The previous Map structure was resulting in all userAssets stores accessed during runtime being held permanently in memory. On top of that, `useWalletsHiddenBalances` was repeatedly looping through all wallets on app launch, causing every userAssets store to be accessed and thus held in memory. Now, hidden asset balances are summed any time a specific wallet's assets are synced to Zustand, and any time `setHiddenAssets` is called. That total is saved to `userAssetsStoreManager`'s persisted state, allowing all of the user's hidden wallet balances to be read from a single source, with no need to loop through individual stores. The tradeoff here, which I think is acceptable, is that users will temporarily see their hidden balances reflected in each wallet's total balance, until that wallet next fetches assets. That seems benign enough to forgo a migration.
Super speedy ⚡ |
lgtm |
lgtm. 🚢 |
lgtm 🤠 |
lgtm 🐎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
export const persistOptions: Omit<PersistQueryClientOptions, 'queryClient'> = { | ||
persister: asyncStoragePersister, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️
lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
`chainBalances.size` will only be zero if `setUserAssets` has never been called for the active store. If `setUserAssets` has been called, `chainBalances` will be populated, regardless of whether the wallet has assets.
The first run of any `useAnimatedStyle` or `useDerivedValue` is executed on the JS thread. The first run can be detected by checking if `_WORKLET` is `false`, which allows bypassing expensive JS thread SV reads if you can set the hook's initial return value through other means. These changes bypass the vast majority of JS thread SV reads throughout the browser, which reduces JS thread blocking post app launch and during browser tab creation.
Prevents tab switch gestures from activating when the browser search UI is open
- Fixes Android device height and safe area determinations, which were previously inconsistent in what was considered part of the safe area vs. part of the device height — this was causing various UI dimensions to be miscalculated, for instance browser tab heights - Provides the `SafeAreaProvider` with `initialWindowMetrics` which on Android prevents layout shift on initial app launch - Sets the bottom bar background to transparent when button navigation isn't being used - Now correctly handling dimensions regardless of whether the device uses button navigation
The gesture blocking isn't needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ship it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Fixes APP-1603
Fixes APP-2249
What changed (plus any additional context for devs)
Memory Management:
useWalletsHiddenBalances
was looping through all wallets on app launch, causing every userAssets store to be accessed and thus held in memorysetHiddenAssets
is calleduserAssetsStoreManager
's persisted state, allowing all hidden wallet balances to be read from a single source, with no need to loop through individual stores or walletsqueryClient:
MMKVPersister
with an 8s trailing debounce, which seems to be lighter than the old async persistermaxAge
to restrict query cache growthJS thread Shared Value Reads:
_WORKLET
isfalse
, allowing bypassing these expensive reads if you can set the hook's initial return value through other meansAndroid UI Fixes:
SafeAreaProvider
withinitialWindowMetrics
which on Android prevents layout shift on app launch-Now correctly handling dimensions regardless of whether the device uses button navigation
Package Upgrades:
1.5.10
→1.8.2
3.16.3
→3.16.6
Additional Changes
Screen recordings / screenshots
What to test