Fix/state management cleanup - #345
Merged
El-swaggerito merged 2 commits intoJul 29, 2026
Merged
Conversation
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 #334
Summary
Clean up dashboard state management patterns by standardizing how custom hooks expose global state to React components.
Changes
useVault.ts: Removed duplicate local state logic. The hook now re-exportsuseVault,useVaultContext, andVaultProviderfrom@/contexts/VaultContext.useGovernance.ts: Removed duplicate local state logic. The hook now re-exportsuseGovernance,useGovernanceContext, andGovernanceProviderfrom@/contexts/GovernanceContext.VaultContext.tsxandGovernanceContext.tsxnow exportuseVaultanduseGovernancealiases respectively, to match the pattern used inWalletContext.tsx.useVaultContextanduseGovernanceContextto use the unified hooks@/hooks/useVaultand@/hooks/useGovernance. Affected components includedashboard.tsx,analytics.tsx,governance.tsx,AnalyticsDashboard.tsx,MemoizedAnalyticsDashboard.tsx,GlobalSearch.tsx, andfeatures/governance/index.ts.docs/state_management.mdto document the convention that hooks proxy the context and global state lives in Context, preventing future regressions.Why
Previously,
useVault.tsanduseGovernance.tsmaintained their own copies of state which was heavily duplicated with their corresponding context providersVaultContext.tsxandGovernanceContext.tsx. This led to unnecessary duplication and lack of clear state ownership. This PR clarifies state ownership by strictly delegating global state to Context and using hooks simply to expose this state to components, mirroring the clean architecture ofWalletContext.Verification
Manually verified that types compile and existing UI components integrate smoothly with the standardized hooks.