chore(6927): upgrade react-redux v7 → v8#43209
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
✨ Files requiring CODEOWNER review ✨🔑 @MetaMask/accounts-engineers (3 files, +27 -9)
✅ @MetaMask/confirmations (15 files, +48 -46)
👨🔧 @MetaMask/core-extension-ux (2 files, +7 -4)
🫰 @MetaMask/core-platform (1 files, +1 -1)
👨🔧 @MetaMask/earn (3 files, +8 -3)
🔔 @MetaMask/notifications (1 files, +14 -32)
👨🔧 @MetaMask/perps (1 files, +4 -5)
📜 @MetaMask/policy-reviewers (12 files, +348 -76)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🔄 @MetaMask/swaps-engineers (1 files, +16 -11)
🔐 @MetaMask/web3auth (3 files, +24 -8)
|
Builds ready [8f52ccc]
⚡ Performance Benchmarks (Total: 🟢 17 pass · 🟡 0 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [73cee8f]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 6 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [d020a16]
⚡ Performance Benchmarks (Total: 🟢 19 pass · 🟡 6 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [39db734]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 7 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
39db734 to
a5b60d5
Compare
Builds ready [a5b60d5]
⚡ Performance Benchmarks (Total: 🟢 18 pass · 🟡 7 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
a5b60d5 to
7b77bc9
Compare
Builds ready [7b77bc9]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 11 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
7b77bc9 to
37e64a4
Compare
Builds ready [37e64a4]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [d89c054]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 11 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Pull request overview
Upgrades the extension’s Redux/React integration by moving from react-redux v7 to v8 (for React 18 compatibility), removing the DefaultRootState type, and adjusting selectors/hooks/tests to satisfy the newer selector stability expectations.
Changes:
- Bump
react-reduxto^8.1.0, remove@types/react-redux, and update lockfile/policies accordingly. - Replace
DefaultRootStateusages withMetaMaskReduxStateand introduce typed app hooks (useAppSelector,useAppDispatch). - Refactor multiple selectors/hooks/tests to reduce React-Redux v8 stability warnings (memoized selectors, stable empty fallbacks, and updated test provider wrappers).
Reviewed changes
Copilot reviewed 68 out of 70 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates dependency resolution for react-redux v8 and newly pulled packages. |
| package.json | Bumps react-redux and removes @types/react-redux. |
| ui/store/store.ts | Adds typed useAppDispatch and adjusts imports for v8 usage. |
| ui/selectors/subscription/subscription.ts | Memoizes getUserSubscriptions via createSelector. |
| ui/selectors/signatures.ts | Replaces DefaultRootState with MetaMaskReduxState in selector typing. |
| ui/selectors/signatures.test.ts | Updates tests to use MetaMaskReduxState typing/casts. |
| ui/selectors/selectors.js | Refactors selectors for stable outputs (e.g., createSelector, stable fallbacks). |
| ui/selectors/musd/persisted-state.ts | Introduces stable empty fallback for dismissed CTA keys. |
| ui/selectors/multichain/networks.ts | Memoizes multichain network derivation and stabilizes provider list. |
| ui/selectors/multichain.ts | Converts getMultichainDefaultToken to a memoized selector. |
| ui/pages/settings/shared/create-toggle-item.tsx | Adjusts dispatch typing/casting for v8/thunk compatibility. |
| ui/pages/confirmations/hooks/useIsEnforcedSimulationsEligible.ts | Stabilizes selector usage and adds equality fn to reduce rerenders. |
| ui/pages/confirmations/hooks/signatures/useSignatureRequest.ts | Switches to useAppSelector for typed selection. |
| ui/pages/confirmations/hooks/send/useSendQueryParams.test.ts | Removes DefaultRootState usage in test helper typing. |
| ui/pages/confirmations/hooks/send/useMaxAmount.ts | Switches to useAppSelector and updates state typing. |
| ui/pages/confirmations/hooks/send/useMaxAmount.test.ts | Updates hook test state typing/casts for v8 changes. |
| ui/pages/confirmations/hooks/send/useCurrencyConversions.test.ts | Removes DefaultRootState usage in test helper typing. |
| ui/pages/confirmations/hooks/send/useBalance.test.ts | Replaces DefaultRootState with MetaMaskReduxState in tests. |
| ui/pages/confirmations/hooks/alerts/useShieldCoverageAlert.ts | Adds equality fn to stabilize selector outputs under v8. |
| ui/pages/confirmations/components/confirm/title/title.test.tsx | Fixes state factory usage (getMock...() invocation). |
| ui/pages/confirmations/components/confirm/header/wallet-initiated-header.test.tsx | Removes DefaultRootState and simplifies render helper typing. |
| ui/pages/confirmations/components/confirm/header/simple-confirmation-header.test.tsx | Updates render helper state typing to MetaMaskReduxState. |
| ui/pages/confirmations/components/confirm/header/header.test.tsx | Updates render helper typing to avoid DefaultRootState. |
| ui/pages/confirmations/components/confirm/header/dapp-initiated-header.test.tsx | Removes DefaultRootState and simplifies render helper typing. |
| ui/pages/confirmations/components/confirm/footer/single-action-footer.test.tsx | Removes DefaultRootState cast from base state. |
| ui/pages/confirmations/components/confirm/footer/footer.test.tsx | Extends mocked subscription shape to match selector expectations. |
| ui/pages/asset/components/musd-convert-section.test.tsx | Stabilizes mocked network-config selector return value. |
| ui/pages/asset/components/musd-bonus-section.test.tsx | Stabilizes mocked network-config selector return value. |
| ui/hooks/useTrustSignals.ts | Adds equality fn to stabilize derived-array selector results. |
| ui/hooks/useNetworkConnectionBanner.test.ts | Uses store dispatch to trigger updates instead of relying on rerender. |
| ui/hooks/useMultichainSelector.ts | Updates default state type and stabilizes selector callback. |
| ui/hooks/useHardwareWalletRecoveryLocation.ts | Switches to useAppSelector for typed selection. |
| ui/hooks/useDisplayName.ts | Stabilizes derived selector callback and adds equality fn. |
| ui/hooks/useAlerts.ts | Adds equality fn for derived selector output stability. |
| ui/hooks/useAccountGroupForPermissions.test.ts | Updates Provider wrapper creation to pass children explicitly. |
| ui/hooks/subscription/useAddFundTrigger.test.ts | Extends mocked subscription shape to include lastSubscription. |
| ui/hooks/rewards/useOptIn.ts | Calls updateMetaMetricsTraits directly (Promise API) vs dispatching it. |
| ui/hooks/musd/useMusdCtaVisibility.test.ts | Updates Provider wrapper creation to pass children explicitly. |
| ui/hooks/musd/useMusdConversionTokens.test.ts | Updates Provider wrapper creation to pass children explicitly. |
| ui/ducks/metamask/metamask.js | Introduces stable empty fallbacks for NFTs/contracts selectors. |
| ui/ducks/bridge/actions.ts | Updates thunk getState typing and adjusts casts for bridge selectors. |
| ui/contexts/shield/shield-subscription.test.tsx | Mocks react-redux hooks via module mock for stability with v8. |
| ui/contexts/metamask-notifications/metamask-notifications.test.ts | Uses store dispatch to trigger updates; removes custom useSelector wrapping. |
| ui/contexts/identity/index.test.tsx | Mocks useSelector via module mock for v8 stability. |
| ui/contexts/assetPolling.test.tsx | Mocks useSelector via module mock for v8 stability. |
| ui/components/multichain/activity-v2/useTransactionsQuery.test.ts | Updates Provider wrapper creation to pass children explicitly. |
| ui/components/multichain-accounts/multichain-site-cell/tool-tip/multichain-site-cell-tooltip.tsx | Stabilizes derived selector callback and adds equality fn. |
| ui/components/multichain-accounts/multichain-account-network-group/multichain-account-network-group.tsx | Stabilizes derived selector callback and adds equality fn. |
| ui/components/app/wallet-overview/coin-buttons.tsx | Switches one selection to useAppSelector for typed state. |
| ui/components/app/toast-master/selectors.ts | Adds memoization/caching to stabilize privacy toast selector output. |
| ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.js | Makes selector equality fn null-safe for content comparison. |
| ui/components/app/perps/hooks/usePerpsWithdrawNavigation.test.ts | Updates Provider wrapper creation to pass children explicitly. |
| ui/components/app/currency-input/hooks/useTokenExchangeRate.test.tsx | Switches tests to MetaMaskTestReduxProvider to disable v8 checks. |
| types/react-redux.d.ts | Augments useDispatch typing to support thunk dispatch by default. |
| test/lib/render-helpers-navigate.js | Introduces MetaMaskTestReduxProvider usage and returns store from hook render helper. |
| test/lib/redux-test-provider.tsx | New test-only provider wrapper disabling v8 selector/noop checks. |
| test/lib/confirmations/render-helpers.tsx | Uses MetaMaskTestReduxProvider in confirmations render helpers. |
| test/jest/console-baseline-integration.json | Updates expected warning baselines after selector stability changes. |
| lavamoat/webpack/mv3/main/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/webpack/mv3/flask/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/webpack/mv3/experimental/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/webpack/mv3/beta/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/webpack/mv2/main/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/webpack/mv2/flask/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/webpack/mv2/experimental/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/webpack/mv2/beta/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/browserify/main/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/browserify/flask/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/browserify/experimental/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
| lavamoat/browserify/beta/policy.json | Updates LavaMoat allowlist for new react-redux dependency graph. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let _privacyToastLastArgs: [unknown, unknown, unknown] | null = null; | ||
| let _privacyToastLastResult: { | ||
| showPrivacyPolicyToast: boolean; | ||
| newPrivacyPolicyToastShownDate?: number | null; | ||
| } | null = null; | ||
|
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Builds ready [83d1c6f]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…ean selector (and reading newPrivacyPolicyToastShownDate separately)
83d1c6f to
10348b2
Compare
Upgrades
react-reduxfrom^7.2.9to^8.1.0for React 18 compatibility (useSyncExternalStorewith a shim for React 16/17). Removes@types/react-reduxsince v8 ships its own TypeScript declarations.CHANGELOG entry: null
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6927
Package changes
react-redux:^7.2.9→^8.1.0@types/react-redux: removed fromdevDependencies(v8 has built-in types)DefaultRootStateremovalv8 drops
DefaultRootState. All usages replaced with the project'sMetaMaskReduxStatetype (orRecord<string, unknown>for loose test-only spread overrides).Production code (3 files):
ui/hooks/useMultichainSelector.ts— default type paramTState = DefaultRootState→TState = MetaMaskReduxStateui/selectors/signatures.ts—createSelectorinput function state paramsui/pages/confirmations/hooks/send/useMaxAmount.ts— function-cast type annotation insideuseSelectorTest files (9 files): state parameter annotations in render helpers across
confirmations/hooks/send/andconfirmations/components/confirm/.