fix(wallet): clear React Query cache on Stellar wallet disconnect#214
Open
PrettyFox0 wants to merge 1 commit into
Open
fix(wallet): clear React Query cache on Stellar wallet disconnect#214PrettyFox0 wants to merge 1 commit into
PrettyFox0 wants to merge 1 commit into
Conversation
Closes Neko-Protocol#208 useStellarWallet.disconnect() previously only cleared the Zustand wallet store; user-specific cached queries (balances, borrow positions, backstop state, etc.) stayed in memory and briefly flashed across features when a second wallet connected in the same session. Now removes from the cache: - queries under any known user-scoped key prefix (balances, backstopDeposit, borrowLimit, health-factor, kyc-status, portfolio-value, tokenBalance, userCollateral, userDebt, vaultBalance, ...etc) - any query whose key array contains the disconnecting address (catches trailing-address keys like ['orchestrator', 'position', poolId, addr]) Protocol-level queries (pool configs, oracle prices, vault APY) are intentionally left cached — they hold no user data.
|
Someone is attempting to deploy a commit to the Oppia Software Labs Team on Vercel. A member of the Team first needs to authorize it. |
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 #208
Summary
`useStellarWallet.disconnect()` previously only cleared the Zustand wallet store; user-specific cached queries (balances, borrow positions, backstop state, etc.) stayed in memory and briefly flashed across features when a second wallet connected in the same session.
Fix
`disconnect()` now calls `queryClient.removeQueries(...)` with a predicate that removes:
Protocol-level queries (pool configs, oracle prices, vault APY) are intentionally left cached — they hold no user data and re-fetching them on every reconnect would add unnecessary latency.
Documented user-scoped prefixes
`backstopDeposit`, `backstopWalletBalance`, `balances`, `borrowLimit`, `cetesBalance`, `etherfuse-assets`, `health-factor`, `kyc-status`, `portfolio-value`, `repayWalletBalance`, `stellar-balances`, `tokenBalance`, `userCollateral`, `userDebt`, `vaultBalance`.
Acceptance criteria