refactor: migrate config singleton to React Context (WIP)#3972
Draft
DBosley wants to merge 4 commits into
Draft
Conversation
❌ Deploy Preview for wormhole-connect failed.
|
❌ Deploy Preview for wormhole-connect-mainnet failed.
|
Introduces React Context pattern for config access, enabling future support for multiple WormholeConnect instances on the same page. Changes: - Add ConfigContext with ConfigProvider and useConfig() hook - Wrap WormholeConnect with ConfigProvider - Update AppRouter to use useConfig() (example migration) - Add TestConfigContext pattern in testHelpers for test isolation - Mark singleton export with @deprecated JSDoc - Fix TypeScript dev server errors (@types/color, env.d.ts) The singleton remains functional for backwards compatibility. Migration can proceed incrementally file-by-file.
Planning documentation for the config singleton, Redux store, and wallet state refactoring efforts.
Convert hooks from direct config import to useConfig() hook: - useAutoEnableGasDropoff, useAvailableWallets, useComputeDestinationTokens - useConfirmTransaction, useExternalSearch, useFetchQuotes - useFetchSupportedRoutes, useGasSlider, useGetTokenBalances - useGetTokens, useSortedRoutesWithQuotes, useTokenList - useTokenListWithSearch, useTrackTransfer, useTransactionHistory - useTransactionHistoryLiFi, useTransactionHistoryMayan, useTransactionHistoryWHScan
Convert React components from direct config import to useConfig() hook: - Views: Terms, Bridge (all subcomponents), Redeem, TxHistory - Components: ConfigurablePageHeader, FooterNavBar - Contexts: WalletProvider - Icons: PoweredBy
DBosley
force-pushed
the
side-effect-refactor
branch
from
December 4, 2025 20:07
7825017 to
909a5da
Compare
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.
Summary
Refactors the global config singleton to use React Context for instance-scoped configuration. This enables:
Current Status: Phase 2 Complete (WIP)
Completed
ConfigProvider,useConfig()hook)useConfig()Remaining (not in this PR yet)
Migration Pattern
Components now use:
Backwards Compatibility
The app remains fully functional during migration - both patterns work:
useConfig()reads from React ContextTest plan