Skip to content
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

redux upgrade #17396

Merged
merged 1 commit into from
Mar 7, 2025
Merged

redux upgrade #17396

merged 1 commit into from
Mar 7, 2025

Conversation

Nodonisko
Copy link
Contributor

@Nodonisko Nodonisko commented Mar 4, 2025

Description

This was real pain to do because lot of legacy stuff combined with new one and lot breaking changes in redux types.

Most of changes should TS only so I hope it won't break anything. I had to use few any and unknown and I am not proud of it, but I don't think it affects type safety so let's call it a day.

Related Issue

Resolve

Screenshots:

@Nodonisko Nodonisko force-pushed the chore/upgrade-redux branch from 8ee62e5 to ffa5310 Compare March 5, 2025 07:47
Copy link

github-actions bot commented Mar 5, 2025

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 26
  • More info

Learn more about 𝝠 Expo Github Action

@Nodonisko Nodonisko force-pushed the chore/upgrade-redux branch 6 times, most recently from bf80f94 to cbd5868 Compare March 5, 2025 14:21
@Nodonisko Nodonisko added the no-project This label is used to specify that PR doesn't need to be added to a project label Mar 5, 2025
@Nodonisko Nodonisko marked this pull request as ready for review March 5, 2025 14:24
Copy link

coderabbitai bot commented Mar 5, 2025

Walkthrough

The pull request implements widespread updates and refinements across various packages in the project. Most notably, key dependencies related to Redux are upgraded—such as updating @reduxjs/toolkit from 1.9.5 to 2.6.0, react-redux from 8.0.7 to 9.2.0, along with updates to redux, redux-thunk, and related type definitions. In addition, several modules standardize import styles, for example, transitioning the produce function from a default export to a named import from the Immer library. TypeScript enhancements are evident through improved type annotations, simplified variable declarations in test files, and added type guards to ensure better type safety. Changes also refine middleware configuration and store initialization across desktop, web, common utilities, and React Native modules, thereby promoting consistency across the entire codebase.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (13)
suite-native/state/src/reducers.ts (1)

224-224: Type assertion enhances type safety in Redux store setup

Adding as const to the object passed to combineReducers is a good practice when upgrading to Redux Toolkit 2.x. This assertion ensures that TypeScript infers the most specific literal type for each property, which provides better type safety throughout the Redux flow.

Given that you're upgrading to Redux Toolkit 2.6.0, consider leveraging the newer combineSlices approach for combining reducers if you plan any future refactoring. It provides better TypeScript inference and simplified usage.

#!/bin/bash
# Check for any existing usage of combineSlices in the codebase
rg "combineSlices" -A 2 -B 2
suite-common/trading/package.json (1)

14-14:

❓ Verification inconclusive

Major Redux Toolkit version upgrade

Upgrading from 1.9.5 to 2.6.0 represents a significant major version change that includes breaking changes. Verify that all Redux-related code throughout this package has been properly adjusted for compatibility.

The jump from Redux Toolkit 1.x to 2.x introduces breaking changes in types and API. If you're encountering any issues with this package specifically, I can help identify and fix compatibility problems related to this dependency change.


🌐 Web query:

What are the breaking changes in Redux Toolkit 2.0?

Error during web search


Action: Verify Compatibility with Redux Toolkit 2.6.0

The dependency upgrade in suite-common/trading/package.json from Redux Toolkit 1.9.5 to 2.6.0 is a significant change that may introduce breaking changes in both API usage and type definitions. Since our recent attempt to retrieve details on the breaking changes via web search encountered an error, please ensure that:

  • All Redux-related code throughout the package is reviewed for compatibility, including store configurations, slice definitions, and middleware setups.
  • Type definitions and API usage are updated to address potential changes introduced in Redux Toolkit 2.x.
  • The official Redux Toolkit release notes for version 2.x are consulted to identify any additional breaking changes that could impact your implementation.

If you encounter any issues or need further assistance adjusting the Redux-related code, I'm here to help.

suite-common/wallet-core/package.json (1)

15-15: Redux Toolkit Dependency Upgrade
The dependency upgrade to @reduxjs/toolkit version "2.6.0" is implemented here. Please verify that all parts of the code consuming the toolkit (including middleware, store configuration, etc.) are compatible with any breaking changes or new API patterns introduced in this version.

suite-common/analytics/package.json (1)

13-13: Consistent Redux Toolkit Version Bump
The update to @reduxjs/toolkit version "2.6.0" in this package is aligned with the broader Redux upgrade. Be sure to run integration and unit tests to confirm that all Redux-related operations behave as expected under the new version.

suite-native/module-authenticity-checks/package.json (1)

27-27: React Redux Upgrade Notice
The react-redux dependency has been updated from "8.0.7" to "9.2.0". Please verify that all connected components and hooks using React Redux (e.g., useSelector, useDispatch) work correctly with the upgraded version and that any breaking changes have been addressed.

suite-native/settings/package.json (1)

13-13: Redux Toolkit Upgrade in Native Settings Module
The upgrade to @reduxjs/toolkit version "2.6.0" is applied here. Ensure that the state management setup and any middleware configurations are compatible with the new version. Running the test suite is recommended to catch any potential regressions due to this upgrade.

packages/suite/src/reducers/suite/index.ts (1)

20-20: Type annotation removal is appropriate with Redux Toolkit 2.x.

The removal of the explicit Reducer type annotation allows TypeScript to correctly infer the type from prepareMessageSystemReducer. This change aligns with Redux Toolkit 2.x best practices, which has improved type inference.

Note that the comment on line 19 mentioning this as a "workaround for type-check error" is now outdated and could be removed since the workaround is no longer necessary.

-// Type annotation as workaround for type-check error "The inferred type of 'default' cannot be named..."
 const messageSystem = prepareMessageSystemReducer(extraDependencies);
packages/connect-explorer/src/store/index.ts (1)

9-9: Added explicit typing to middleware array

The middleware array is now explicitly typed as any[] which may help with type compatibility during the Redux migration. However, consider using a more specific type once the migration is complete.

Once the Redux upgrade is fully stabilized, consider replacing any[] with a more specific type like:

-const middleware: any[] = [thunk, trezorConnectMiddleware];
+const middleware: Middleware[] = [thunk, trezorConnectMiddleware];

This would require importing the Middleware type from Redux:

import { Middleware } from 'redux';
suite-native/state/src/store.ts (1)

45-45: Type casting could be improved

The explicit type casting of preloadedState to FullPreloadedState works but isn't ideal.

Consider refining the type definitions to avoid the need for explicit type casting:

-        preloadedState: preloadedState as FullPreloadedState,
+        preloadedState: preloadedState,

This would require adjusting the PreloadedState type definition to make it compatible with what configureStore expects.

suite-common/redux-utils/src/types.ts (1)

26-36: Consider using explicit Action types for match functions

The AnyAsyncThunk type uses any for the action types in match functions, which loses some type safety. While this is likely for compatibility reasons, it might be worth revisiting in the future.

Consider defining more specific types for the actions:

type AnyAsyncThunk = {
    pending: {
-        match: (action: any) => action is any;
+        match: <P>(action: Action<any>) => action is Action<string> & { payload: P };
    };
    fulfilled: {
-        match: (action: any) => action is any;
+        match: <P>(action: Action<any>) => action is Action<string> & { payload: P };
    };
    rejected: {
-        match: (action: any) => action is any;
+        match: <E>(action: Action<any>) => action is Action<string> & { error: E };
    };
};
packages/suite/global.d.ts (2)

47-58: Replace empty object type with explicit Record type

The use of {} as a type is discouraged. It's better to use a more explicit type like Record<string, never> for an empty object.

export interface Middleware<
-    _DispatchExt = {},
+    _DispatchExt = Record<string, never>,
    S = any,
    D extends Dispatch = Dispatch<AnyAction>,
> {
    (api: MiddlewareAPI<D, S>): (next: Dispatch<AnyAction>) => (action: any) => any;
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


60-61: Remove unnecessary empty export

This empty export statement is not needed since the file already contains exports from the declared module.

-export {};
🧰 Tools
🪛 Biome (1.9.4)

[error] 60-61: This empty export is useless because there's another export or import.

This import makes useless the empty export.

Safe fix: Remove this useless empty export.

(lint/complexity/noUselessEmptyExport)

suite-common/test-utils/src/configureMockStore.ts (1)

26-37: Updated type definitions in configureMockStore function

The type definitions have been updated to match the new Redux Toolkit API, but there are some concerns:

  1. The use of {} as a type in Reducer<S, A, {}> is problematic - this means "any non-nullable value"
  2. Several any types might reduce type safety

Consider replacing the empty object type {} with a more specific state type to improve type safety:

-    reducer?: Reducer<S, A, {}> | ReducersMapObject<S, A, {}>;
+    reducer?: Reducer<S, A, unknown> | ReducersMapObject<S, A, unknown>;
🧰 Tools
🪛 Biome (1.9.4)

[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ceb675 and cbd5868.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (102)
  • packages/connect-explorer/package.json (1 hunks)
  • packages/connect-explorer/src/store/index.ts (1 hunks)
  • packages/suite-desktop-connect-popup/package.json (2 hunks)
  • packages/suite-desktop-ui/package.json (1 hunks)
  • packages/suite-web/package.json (1 hunks)
  • packages/suite/global.d.ts (1 hunks)
  • packages/suite/package.json (4 hunks)
  • packages/suite/src/actions/suite/__tests__/storageActions.test.ts (1 hunks)
  • packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts (2 hunks)
  • packages/suite/src/middlewares/suite/__tests__/messageSystemMiddleware.test.ts (0 hunks)
  • packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts (1 hunks)
  • packages/suite/src/middlewares/suite/suiteMiddleware.ts (2 hunks)
  • packages/suite/src/reducers/backup/backupReducer.ts (1 hunks)
  • packages/suite/src/reducers/onboarding/onboardingReducer.ts (1 hunks)
  • packages/suite/src/reducers/recovery/recoveryReducer.ts (1 hunks)
  • packages/suite/src/reducers/store.ts (3 hunks)
  • packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts (7 hunks)
  • packages/suite/src/reducers/suite/desktopUpdateReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/index.ts (1 hunks)
  • packages/suite/src/reducers/suite/metadataReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/protocolReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/suiteReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/windowReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/accountSearchReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/cardanoStakingReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/coinjoinReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/formDraftReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/graphReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/receiveReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/settingsReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/tradingReducer.ts (1 hunks)
  • packages/suite/src/support/tests/configureStore.tsx (1 hunks)
  • suite-common/analytics/package.json (1 hunks)
  • suite-common/bluetooth/package.json (1 hunks)
  • suite-common/connect-init/package.json (2 hunks)
  • suite-common/device-authenticity/package.json (1 hunks)
  • suite-common/firmware/package.json (1 hunks)
  • suite-common/graph/package.json (2 hunks)
  • suite-common/logger/package.json (1 hunks)
  • suite-common/message-system/package.json (2 hunks)
  • suite-common/redux-utils/package.json (2 hunks)
  • suite-common/redux-utils/src/createMiddleware.ts (3 hunks)
  • suite-common/redux-utils/src/hooks/useSelectorDeepComparison.ts (1 hunks)
  • suite-common/redux-utils/src/types.ts (2 hunks)
  • suite-common/suite-types/package.json (1 hunks)
  • suite-common/suite-utils/src/device.ts (2 hunks)
  • suite-common/test-utils/package.json (2 hunks)
  • suite-common/test-utils/src/configureMockStore.ts (3 hunks)
  • suite-common/toast-notifications/package.json (1 hunks)
  • suite-common/token-definitions/package.json (1 hunks)
  • suite-common/trading/package.json (1 hunks)
  • suite-common/trading/src/thunks/buy/__tests__/handleRequestThunk.test.ts (1 hunks)
  • suite-common/wallet-core/package.json (1 hunks)
  • suite-common/wallet-core/src/send/sendFormThunks.ts (6 hunks)
  • suite-common/walletconnect/package.json (1 hunks)
  • suite-native/accounts/package.json (2 hunks)
  • suite-native/app/package.json (2 hunks)
  • suite-native/assets/package.json (1 hunks)
  • suite-native/atoms/package.json (1 hunks)
  • suite-native/coin-enabling/package.json (2 hunks)
  • suite-native/connection-status/package.json (1 hunks)
  • suite-native/device-authorization/package.json (2 hunks)
  • suite-native/device-manager/package.json (2 hunks)
  • suite-native/device/package.json (2 hunks)
  • suite-native/device/src/middlewares/deviceMiddleware.ts (2 hunks)
  • suite-native/device/src/utils.ts (1 hunks)
  • suite-native/discovery/package.json (2 hunks)
  • suite-native/feature-flags/package.json (1 hunks)
  • suite-native/firmware/package.json (2 hunks)
  • suite-native/firmware/src/nativeFirmwareSlice.ts (1 hunks)
  • suite-native/formatters/package.json (1 hunks)
  • suite-native/graph/package.json (2 hunks)
  • suite-native/icons/package.json (1 hunks)
  • suite-native/message-system/package.json (2 hunks)
  • suite-native/module-accounts-import/package.json (2 hunks)
  • suite-native/module-accounts-management/package.json (2 hunks)
  • suite-native/module-add-accounts/package.json (2 hunks)
  • suite-native/module-authenticity-checks/package.json (1 hunks)
  • suite-native/module-authorize-device/package.json (2 hunks)
  • suite-native/module-connect-popup/package.json (1 hunks)
  • suite-native/module-dev-utils/package.json (1 hunks)
  • suite-native/module-device-settings/package.json (2 hunks)
  • suite-native/module-home/package.json (2 hunks)
  • suite-native/module-onboarding/package.json (2 hunks)
  • suite-native/module-send/package.json (2 hunks)
  • suite-native/module-settings/package.json (2 hunks)
  • suite-native/module-staking-management/package.json (2 hunks)
  • suite-native/module-trading/package.json (1 hunks)
  • suite-native/module-trading/src/hooks/__tests__/useReceiveAccountsListData.test.tsx (3 hunks)
  • suite-native/module-trading/tsconfig.json (1 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/notifications/package.json (1 hunks)
  • suite-native/receive/package.json (2 hunks)
  • suite-native/settings/package.json (1 hunks)
  • suite-native/state/package.json (2 hunks)
  • suite-native/state/src/reducers.ts (1 hunks)
  • suite-native/state/src/store.ts (3 hunks)
  • suite-native/storage/package.json (1 hunks)
  • suite-native/storage/src/typedPersistReducer.ts (2 hunks)
  • suite-native/test-utils/package.json (1 hunks)
  • suite-native/test-utils/src/StoreProviderForTests.tsx (1 hunks)
  • suite-native/transactions/package.json (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/suite/src/middlewares/suite/tests/messageSystemMiddleware.test.ts
✅ Files skipped from review due to trivial changes (16)
  • packages/suite/src/reducers/suite/protocolReducer.ts
  • packages/suite/src/reducers/suite/desktopUpdateReducer.ts
  • packages/suite/src/reducers/onboarding/onboardingReducer.ts
  • packages/suite/src/reducers/wallet/tradingReducer.ts
  • packages/suite/src/reducers/wallet/accountSearchReducer.ts
  • packages/suite/src/reducers/suite/suiteReducer.ts
  • packages/suite/src/reducers/wallet/graphReducer.ts
  • packages/suite/src/reducers/wallet/settingsReducer.ts
  • packages/suite/src/reducers/wallet/cardanoStakingReducer.ts
  • packages/suite/src/reducers/wallet/receiveReducer.ts
  • packages/suite/src/reducers/suite/metadataReducer.ts
  • packages/suite/src/actions/suite/tests/storageActions.test.ts
  • packages/suite/src/reducers/suite/windowReducer.ts
  • packages/suite/src/reducers/wallet/coinjoinReducer.ts
  • packages/suite/src/reducers/wallet/formDraftReducer.ts
  • packages/suite/src/reducers/backup/backupReducer.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/suite/src/support/tests/configureStore.tsx

[error] 13-13: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 20-20: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

packages/suite/global.d.ts

[error] 60-61: This empty export is useless because there's another export or import.

This import makes useless the empty export.

Safe fix: Remove this useless empty export.

(lint/complexity/noUselessEmptyExport)


[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

suite-common/test-utils/src/configureMockStore.ts

[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: e2e-test-suite-web (@group=wallet)
  • GitHub Check: e2e-test-suite-web (@group=other)
  • GitHub Check: e2e-test-suite-web (@group=metadata2)
  • GitHub Check: e2e-test-suite-web (@group=metadata1)
  • GitHub Check: e2e-test-suite-web (@group=settings)
  • GitHub Check: e2e-test-suite-web (@group=device-management)
  • GitHub Check: e2e-test-suite-web (@group=suite)
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Type Checking
  • GitHub Check: Build libs for publishing
  • GitHub Check: Other Checks
  • GitHub Check: Unit Tests
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: test
🔇 Additional comments (154)
packages/suite/src/reducers/recovery/recoveryReducer.ts (1)

1-1: Import statement updated correctly.

The change from a default import to a named import for the produce function is appropriate. This change aligns with the broader Redux upgrade effort in this PR, where similar changes were made across multiple files.

suite-native/storage/src/typedPersistReducer.ts (2)

6-6: Good addition of AnyAction import

This import is necessary for the explicit typing of the persistReducer function and aligns with the Redux upgrade mentioned in the PR objectives.


39-39: Improved type safety with explicit generic parameters

The explicit type parameters in the persistReducer call enhance type safety and provide better TypeScript support. This change is particularly valuable when upgrading Redux, as it ensures proper type checking for both the state and actions.

By specifying AnyAction as the second type parameter, you ensure the reducer properly handles all possible Redux actions, which is consistent with Redux's typing conventions in newer versions.

suite-common/redux-utils/src/createMiddleware.ts (3)

2-2: Import AnyAction from local types rather than Redux

Moving the AnyAction import from Redux to a local types file is a good adjustment for the Redux Toolkit 2.x upgrade, as it allows for more control over the type definition. This approach helps maintain compatibility with the new version while potentially customizing the type to fit your application's needs.

Also applies to: 5-5


41-45: Consistent type assertion pattern applied to createMiddlewareWithExtraDeps

Good consistency in applying the same type assertion pattern to both middleware creators. This ensures uniform type handling across your Redux middleware system.


21-24:

❓ Verification inconclusive

Enhanced type assertions for improved type safety

The explicit type assertions for action and next address potential type incompatibilities introduced in Redux Toolkit 2.x. This change ensures proper type checking throughout the middleware execution chain.


🏁 Script executed:

#!/bin/bash
# Check if there are any TypeScript errors related to action types in the codebase
rg "TS2345|Type '.*' is not assignable to type '.*Action'" -g "*.log" 

Length of output: 232


Below is a revised review comment that reflects the need for manual verification due to inconclusive automated output:


Explicit Type Assertions Strengthen Type Safety in Middleware

The use of explicit type assertions (i.e., action as TAction and next as Dispatch) in suite-common/redux-utils/src/createMiddleware.ts (lines 21–24) effectively guards against potential type mismatches introduced with Redux Toolkit 2.x. These changes improve type enforcement within the middleware chain.

However, note that our initial automated check for TypeScript errors (searching for TS2345-related messages) didn’t yield any output due to a file filter issue. Please ensure that a manual compile or a more targeted check confirms that no type errors remain.

suite-common/walletconnect/package.json (1)

13-13:

❓ Verification inconclusive

Major Redux Toolkit version upgrade

Upgrading from 1.9.5 to 2.6.0 is a significant version jump. Since this is a WalletConnect module that likely interfaces with Redux state, ensure that any Redux selectors, actions, or middleware in this package have been updated to work with the new version.


🏁 Script executed:

#!/bin/bash
# Check for any Redux-related imports in this package that might need updates
cd suite-common/walletconnect || exit 1
echo "Checking Redux usage in WalletConnect package:"
rg -t ts "createSlice|createAction|createReducer|createSelector|useSelector|useDispatch" src/

Length of output: 930


Redux Toolkit v2 Upgrade Compatibility Verification

The dependency upgrade to Redux Toolkit v2.6.0 appears to be applied correctly in the WalletConnect module. The verification confirms that the Redux functions (e.g., createAction in src/walletConnectActions.ts) are still used as expected. Additionally, usage of createReducerWithExtraDeps in src/walletConnectReducer.ts is noted, suggesting that the module’s custom reducer logic should be reviewed against any API changes in v2.6.0.

  • Please ensure that any associated selectors, middleware, or custom utilities (like createReducerWithExtraDeps) remain compatible with the new Redux Toolkit version.
  • It would be beneficial to run integration tests to verify that the state management behavior has not been adversely affected by the upgrade.
suite-common/device-authenticity/package.json (1)

14-14: Redux Toolkit Version Upgrade
The dependency @reduxjs/toolkit has been updated from its previous version to "2.6.0". Please ensure that any breaking changes introduced in the new version are compatible with your current usage in this package.

suite-native/icons/package.json (1)

15-15: Redux Toolkit Upgrade in Icons Package
The dependency @reduxjs/toolkit is now set to "2.6.0". Verify that any code interfacing with this dependency in the icons package properly adheres to any new APIs or behavioral changes introduced in this version.

suite-native/atoms/package.json (1)

16-16: Redux Toolkit Update in Atoms Package
The version of @reduxjs/toolkit has been updated to "2.6.0", keeping this package in line with the overall project upgrade. Ensure that components and state management logic within this package are fully compatible with the updated toolkit.

suite-native/assets/package.json (1)

34-34: React-Redux Dependency Upgrade
The react-redux dependency has been updated to "9.2.0". As this is a significant version bump, please verify that all middleware configurations, store setups, and connected components integrate correctly with the new version.

suite-native/storage/package.json (1)

15-15: Redux Toolkit Version Bump in Storage Package
The dependency @reduxjs/toolkit is upgraded to "2.6.0", which should align with the broader project changes. Confirm that any functionality relying on this library within the storage package continues to work as expected and that any necessary migration adjustments have been made.

suite-common/suite-types/package.json (1)

13-13:

❓ Verification inconclusive

Type Safety and API Compatibility Check
The dependency update to @reduxjs/toolkit "2.6.0" is applied here. Ensure that the TypeScript type definitions and interfaces (which might be impacted by any API changes) remain accurate and that any related components in the codebase are updated accordingly.


Based on our static search of TypeScript imports in the repository (pending full test suite execution), the usage of @reduxjs/toolkit appears standard with no obvious type definition mismatches. However, since API changes between versions can be subtle, please ensure that you re-run the complete TypeScript build and tests—especially for custom hooks or middleware leveraging RTK APIs—to fully confirm compatibility.

Rewritten Review Comment:

API Type Safety & Compatibility Verification
The update to @reduxjs/toolkit "2.6.0" in suite-common/suite-types/package.json appears consistent with its usage across the codebase. Our preliminary static search for TypeScript imports did not reveal any obvious issues with type definitions or interface mismatches. Please verify the update by running the full TypeScript build and test suite to ensure all related components (e.g., custom hooks, middleware) correctly handle any API changes.


🏁 Script executed:

#!/bin/bash
# Search for TypeScript files importing @reduxjs/toolkit to inspect usage across the codebase
echo "Scanning for '@reduxjs/toolkit' imports in TypeScript files..."
rg "from ['\"]@reduxjs/toolkit['\"]" --type ts

Length of output: 15004


API Type Safety & Compatibility Verification
The dependency update to @reduxjs/toolkit "2.6.0" in suite-common/suite-types/package.json (line 13) has been applied correctly. Our static code search across TypeScript files confirms widespread usage of the package without any immediately obvious type or API compatibility issues. However, subtle differences or missing type updates may still occur.

  • Verify that the complete TypeScript build passes without errors.
  • Ensure that tests for related components (such as custom hooks, middleware, and actions) execute successfully.
  • Double-check any API-specific usage areas to catch potential issues.

Please review these points and run a full test suite to confirm everything behaves as expected.

suite-native/navigation/package.json (1)

38-38: Dependency Upgrade: react-redux now on v9.2.0
Updating the react-redux dependency to "9.2.0" aligns this package with the broader project upgrade. Please ensure that components using react-redux (e.g. providers or hooks) are fully compatible with the new version.

packages/suite-desktop-ui/package.json (1)

30-30: Consistent react-redux Upgrade in Desktop UI
The change to update react-redux to "9.2.0" in the desktop UI package is consistent with the other packages. Verify that any integration logic or middleware relying on react-redux continues to function correctly post-upgrade.

suite-native/formatters/package.json (1)

28-28: react-redux Version Update for Formatters Module
The dependency "react-redux": "9.2.0" has been updated here as well. This reinforces consistency across packages. Ensure that any usage of react-redux functionalities complies with version 9.2.0 requirements.

suite-native/module-trading/tsconfig.json (1)

9-11: New TypeScript Project Reference Added
A new reference { "path": "../../packages/connect" } has been added to the references array. This inclusion appears to be aimed at ensuring the TypeScript compiler can resolve dependencies correctly across packages. Please confirm that this reference is required for the build or integration, and that it does not introduce any circular dependency issues.

suite-native/receive/package.json (2)

16-16: Upgrade of @reduxjs/toolkit: v2.6.0
The dependency update from version "1.9.5" to "2.6.0" for @reduxjs/toolkit introduces improved features and type safety enhancements. Please verify that all Redux-related logic in this package works properly with this major upgrade, as some breaking changes might be present.


43-43: Upgrade of react-redux to v9.2.0
The new version "9.2.0" for react-redux is consistent with updates across the project. Ensure that this change does not affect custom hooks or state management integrations.

suite-native/notifications/package.json (1)

29-29: React-Redux Upgrade: Verify Integration
The dependency react-redux has been updated to version 9.2.0. Please ensure that all connected components, hooks, and middleware integrations are thoroughly tested, as there may be breaking changes or modifications in behavior in the latest version.

suite-common/logger/package.json (1)

13-13:

❓ Verification inconclusive

Redux Toolkit Upgrade: Monitor Potential Breaks
The update of @reduxjs/toolkit to version 2.6.0 may include breaking changes affecting store configuration, slicing logic, or middleware behaviors. Please verify that all Redux-related code (including createSlice, configureStore, etc.) is compatible with the new version and that sufficient tests cover these aspects.


Below is a shell script to search the repository for any Redux Toolkit usage (like createSlice or configureStore) to help verify that all related code is compatible with version 2.6.0:

Please run this script to review which files reference these Redux Toolkit functions and ensure that any usage is compatible with version 2.6.0.


🏁 Script executed:

#!/bin/bash
echo "Searching for Redux Toolkit usage (createSlice and configureStore) in the repository..."
rg -n "createSlice" .
rg -n "configureStore" .

Length of output: 15181


Redux Toolkit Upgrade: Confirm Redux Compatibility Across Codebase

We've detected extensive usage of Redux Toolkit's APIs (e.g., createSlice and configureStore) throughout the repository—including files like suite-common/logger/src/logsSlice.ts, suite-native/state/src/store.ts, and several test files. While no immediate issues have surfaced from our static analysis, it's critical to:

  • Verify that all slices, store configurations, and middleware integrations (particularly those using functions like createSliceWithExtraDeps) are fully compatible with v2.6.0.
  • Ensure that existing tests adequately cover these Redux functionalities to catch any unforeseen breaking changes.
  • Review areas where Redux Toolkit is used in both production and test code to preempt any integration issues.

Diff snippet in suite-common/logger/package.json:

-        "@reduxjs/toolkit": "<previous_version>",
+        "@reduxjs/toolkit": "2.6.0",

Please double-check these points during your next round of testing.

suite-native/test-utils/package.json (2)

15-15: Redux Toolkit Version Update: Confirm Test Utilities Compatibility
The dependency update to @reduxjs/toolkit 2.6.0 should be verified within the test utilities. Ensure that any mocks, store setups, or state management patterns relying on the toolkit are adjusted for potential API or behavior changes.


22-22: React-Redux Update: Validate in Test Context
The change to react-redux 9.2.0 in this test utility package requires verifying that the test environment (providers, hooks, and connection patterns) continues to work as expected. Running full test suites is recommended to uncover any integration issues.

packages/suite-web/package.json (1)

25-25: React-Redux Upgrade: Comprehensive Component Testing
The dependency react-redux has been updated to 9.2.0. Ensure that all components using Redux hooks or the connect API have their behavior validated, and update any type definitions if required.

suite-native/module-connect-popup/package.json (1)

28-28: React-Redux Upgrade: Confirm Module Connectivity
The update to react-redux version 9.2.0 should be revalidated within the module's connectivity logic. Check that all state subscriptions and provider setups function correctly, especially given that this module may rely on legacy patterns that need to work with the updated library.

suite-native/module-dev-utils/package.json (1)

36-36:

❓ Verification inconclusive

Major version upgrade of react-redux requires careful testing.

This upgrade from react-redux 8.0.7 to 9.2.0 represents a major version change that likely includes breaking changes in the Redux API. According to the PR description, there were challenges with Redux types, which is expected in major version updates.


🌐 Web query:

What are the breaking changes between react-redux 8.x and 9.x?

Error during web search


Action Required: Verify React-Redux Upgrade Impact

This upgrade from react-redux 8.0.7 to 9.2.0 is a major version change and may introduce breaking changes, particularly around Redux types. Since the initial web query for breaking changes returned an error, please manually verify the following before finalizing the merge:

  • Review the official release notes for react-redux 9.x to identify all breaking changes compared to 8.x.
  • Test all Redux-related functionality thoroughly, especially areas that might be affected by changes in API behavior or type definitions.
  • Confirm that any custom type definitions or integrations with Redux in the codebase remain compatible with the updated version.

File affected:

  • suite-native/module-dev-utils/package.json at line 36 where "react-redux": "9.2.0" is specified
suite-native/firmware/src/nativeFirmwareSlice.ts (1)

3-3: Exporting interface to support Redux upgrade.

This change makes the NativeFirmwareState interface publicly available, which is likely necessary to accommodate the new Redux typing requirements in version 2.x of @reduxjs/toolkit. This is a good practice as it allows other modules to properly type-check when accessing the firmware state.

suite-common/bluetooth/package.json (1)

14-14:

❓ Verification inconclusive

Major version upgrade of Redux Toolkit requires thorough testing.

This is a significant upgrade from @reduxjs/toolkit 1.9.5 to 2.6.0 which introduces breaking changes, particularly around TypeScript types as mentioned in the PR objectives. RTK 2.x has substantial typing improvements but requires code adjustments.


🌐 Web query:

What are the breaking changes in @reduxjs/toolkit 2.x compared to 1.x?

Error during web search


Action: Verify Compatibility with RTK 2.6.0 in Your TypeScript Code

The upgrade from RTK 1.9.5 to 2.6.0 is a significant change and likely introduces breaking changes related to TypeScript types—even though our automated web query to list all the breaking changes encountered an error. Please ensure that the migration steps for the new RTK version have been fully incorporated, and perform comprehensive testing particularly in areas where Redux Toolkit types or behaviors are used. Be sure to consult the official Redux Toolkit migration guide or release notes to identify any adjustments required in your codebase.

  • Location to Check: suite-common/bluetooth/package.json (line 14 shows the version change)
  • Confirm that all TypeScript-dependent logic using RTK is reviewed and updated.
  • Validate that any subtleties in type inference or behavior changes due to RTK 2.x are accounted for via tests.
suite-native/module-settings/package.json (1)

18-18:

✅ Verification successful

Coordinated upgrade of Redux ecosystem dependencies.

This file updates both @reduxjs/toolkit (1.9.5 → 2.6.0) and react-redux (8.0.7 → 9.2.0), which is important for maintaining compatibility between these closely related libraries. Ensuring consistent versions across all packages is critical for a successful Redux ecosystem upgrade.

Also applies to: 51-51


🏁 Script executed:

#!/bin/bash
# Description: Check if all packages in the codebase are using consistent versions of Redux dependencies

# Check for inconsistent @reduxjs/toolkit versions
echo "Checking for inconsistent @reduxjs/toolkit versions:"
fd --type file "package.json" | xargs grep -l "@reduxjs/toolkit" | xargs grep -H "\"@reduxjs/toolkit\":" | sort

# Check for inconsistent react-redux versions
echo -e "\nChecking for inconsistent react-redux versions:"
fd --type file "package.json" | xargs grep -l "react-redux" | xargs grep -H "\"react-redux\":" | sort

Length of output: 7071


Redux Upgrade Verified

The coordinated upgrade of the Redux ecosystem dependencies is confirmed. The update in suite-native/module-settings/package.json—upgrading "@reduxjs/toolkit" to version "2.6.0" (from 1.9.5) and "react-redux" to "9.2.0" (from 8.0.7)—is consistent across the repository as verified by the script output. All package manifests now reference the new versions, ensuring compatibility between these libraries.

suite-native/connection-status/package.json (1)

22-22: React-Redux Dependency Upgrade Check
The dependency "react-redux": "9.2.0" is updated from the previous version. Please ensure that all usages across the project (especially legacy code) are compatible with any breaking changes introduced by this upgrade.

suite-native/module-authorize-device/package.json (2)

15-15: Redux Toolkit Upgrade Verification
The upgrade of @reduxjs/toolkit to "2.6.0" is noted. Verify that middleware, slice definitions, and any custom configurations correctly accommodate any changes or deprecations introduced in this version.


39-39: React-Redux Dependency Upgrade Confirmation
The update to "react-redux": "9.2.0" should be tested thoroughly for compatibility with existing connected components and TypeScript types, given the known breaking changes in Redux types.

suite-common/toast-notifications/package.json (1)

14-14: Redux Toolkit Version Bump Confirmation
Updating @reduxjs/toolkit from an older version to "2.6.0" appears consistent with the overall upgrade strategy. Confirm that type inferences and middleware usage across the package function as expected after this enhancement.

suite-native/feature-flags/package.json (2)

14-14: Redux Toolkit Upgrade in Feature Flags
The dependency update to "@reduxjs/toolkit": "2.6.0" should be reviewed to ensure any custom hooks or middleware align with the changes in the new version.


18-18: React-Redux Upgrade in Feature Flags
The upgrade to "react-redux": "9.2.0" is in line with the project-wide upgrade. Double-check that any selectors or connected components in this package leverage updated APIs or typings introduced by the new version.

suite-native/discovery/package.json (2)

14-14: Update Redux Toolkit Dependency
Updating @reduxjs/toolkit to "2.6.0" ensures consistency in dependency versions across packages. Verify that the new syntax and type improvements do not introduce any incompatibilities in modules using toolkit features.


32-32: Verify React-Redux Upgrade Impact
The increment to "react-redux": "9.2.0" should be thoroughly tested in the context of this package. Pay close attention to any connected components and legacy typings that may be affected by Redux’s breaking changes.

suite-native/module-home/package.json (2)

16-16: Dependency Update: @reduxjs/toolkit to 2.6.0

The dependency for @reduxjs/toolkit has been upgraded to version 2.6.0 as per the PR objective. Please ensure that any breaking changes or type mismatches introduced with this new version are adequately addressed in the rest of the codebase.


40-40: Dependency Update: react-redux to 9.2.0

The dependency for react-redux is updated from 8.0.7 to 9.2.0. Confirm that the updated library API and any associated type changes have been tested throughout the module.

suite-native/transactions/package.json (2)

16-16: Dependency Update: @reduxjs/toolkit to 2.6.0

The version upgrade to 2.6.0 aligns with the coordinated redux upgrade effort. Double-check that any breaking changes in the toolkit’s APIs are handled in the code referencing Redux state or middleware.


47-47: Dependency Update: react-redux to 9.2.0

The react-redux dependency has been updated to 9.2.0. Please review the component integrations and type assertions to ensure compatibility with the new version.

suite-native/coin-enabling/package.json (2)

15-15: Dependency Update: @reduxjs/toolkit to 2.6.0

Upgrading @reduxjs/toolkit to version 2.6.0 is consistent with the other packages. Verify that any Redux-related middleware or store configurations handle potential breaking changes from this upgrade.


33-33: Dependency Update: react-redux to 9.2.0

The update to react-redux version 9.2.0 should be checked for compatibility with component bindings and hooks. Make sure that no deprecated APIs are in use after this upgrade.

suite-native/module-add-accounts/package.json (2)

17-17: Dependency Update: @reduxjs/toolkit to 2.6.0

The new version 2.6.0 for @reduxjs/toolkit is applied here. It is important to confirm that the change does not affect any custom middleware or Redux slices, especially where advanced TS types are leveraged.


33-33: Dependency Update: react-redux to 9.2.0

The dependency for react-redux has been upgraded to version 9.2.0 to remain consistent with project-wide updates. Please ensure that the new API usage (if any) is reflected in connected components and hooks.

suite-native/device-manager/package.json (2)

15-15: Dependency Update: @reduxjs/toolkit to 2.6.0

The upgrade of @reduxjs/toolkit to 2.6.0 is in line with the PR’s objectives. It is recommended to check that any store enhancers or middleware are updated accordingly to prevent integration issues.


35-35: Dependency Update: react-redux to 9.2.0

Updating react-redux to 9.2.0 should be tested along with all connected components to catch any discrepancies with the new version’s API or type definitions.

suite-common/graph/package.json (2)

15-15: Redux Toolkit Version Upgrade.
The dependency @reduxjs/toolkit has been updated to "2.6.0". Please ensure that any breaking changes introduced in this version have been validated against the code that uses Redux Toolkit within this package.


27-27: React-Redux Version Upgrade.
The dependency react-redux is now set to "9.2.0". Ensure that any API changes or adjustments required by the new version are fully compatible with your current implementation.

suite-native/graph/package.json (2)

16-16: Redux Toolkit Version Upgrade in Native Graph.
The dependency @reduxjs/toolkit has been updated to "2.6.0" here as well. Verify that this version integrates smoothly with your existing native configurations and that any breaking changes are accounted for.


44-44: React-Redux Version Upgrade in Native Graph.
The dependency react-redux is updated to "9.2.0". Please ensure that all native UI components and hooks remain fully operational with this new version.

suite-native/app/package.json (2)

31-31: Redux Toolkit Update in App Package.
The @reduxjs/toolkit dependency is now "2.6.0". Confirm that any middleware or state management logic relying on Redux Toolkit is compatible with this upgrade.


125-125: React-Redux Update in App Package.
The dependency react-redux has been updated to "9.2.0". Please double-check that the updated hooks and API changes in react-redux are properly handled within the app.

suite-common/token-definitions/package.json (1)

17-17: Strict Versioning for Redux Toolkit.
The dependency @reduxjs/toolkit is now pinned to "2.6.0" (changed from a caret version). This enforces an exact version, which can help ensure consistency but may prevent automatic patch updates. Please verify that this decision aligns with your overall dependency management strategy.

suite-common/message-system/package.json (2)

18-18: Redux Toolkit Version Upgrade in Message System.
The dependency @reduxjs/toolkit has been updated to "2.6.0". Ensure that any type or API changes introduced in this version do not adversely affect the message system’s functionality.


31-31: React-Redux Version Upgrade in Message System.
The updated dependency react-redux is now "9.2.0". Confirm that the message system’s usage of react-redux conforms with any new patterns or expectations in this version.

suite-native/module-onboarding/package.json (2)

16-16: Upgrade of @reduxjs/toolkit dependency.
The dependency has been updated to "2.6.0". Please verify that any breaking changes introduced in this version have been addressed in the codebase.


29-29: Upgrade of react-redux dependency.
The version was bumped to "9.2.0". Ensure that usage (especially around hooks and context) is compatible with the new API enhancements and any potential breaking changes.

suite-common/connect-init/package.json (2)

14-14: Upgrade of @reduxjs/toolkit dependency.
The version has been updated to "2.6.0". Confirm that new API changes (if any) are correctly integrated in the connected modules.


26-26: Upgrade of redux-thunk dependency.
The thunk middleware has been updated to "^3.1.0". Please double-check that the middleware integration works as expected with this new version.

suite-native/device/package.json (2)

15-15: Upgrade of @reduxjs/toolkit dependency.
The dependency has been updated to "2.6.0". Verify that all usages of the toolkit are compliant with any changes introduced in the new release.


41-41: Upgrade of react-redux dependency.
Bumped to "9.2.0", this change should be further validated against components using react-redux APIs to ensure full compatibility.

suite-native/firmware/package.json (2)

15-15: Upgrade of @reduxjs/toolkit dependency.
The toolkit dependency now uses "2.6.0". Ensure this update has been thoroughly tested, especially in areas where Redux middleware and async flows are involved.


28-28: Upgrade of react-redux dependency.
The package has been updated to "9.2.0". Confirm that any new API changes or potential deprecations do not adversely affect the integration with the Redux store or connected components.

suite-native/module-device-settings/package.json (2)

16-16: Upgrade of @reduxjs/toolkit dependency.
The dependency now points to "2.6.0". Please verify that all parts of the module relying on Redux Toolkit are updated according to the new version specifications and any breaking changes have been mitigated.


37-37: Upgrade of react-redux dependency.
With the update to "9.2.0", ensure that the changes in react-redux’s API (such as hooks or context modifications) are properly reflected in the application’s components.

suite-native/module-accounts-import/package.json (2)

18-18: Updated @reduxjs/toolkit Dependency Version
The version has been updated to "2.6.0" to align with the broader Redux upgrade. Please verify that this change is compatible with your state management middleware and any custom slices.


52-52: Updated react-redux Dependency Version
The upgrade to "9.2.0" is consistent with the Redux-related dependency updates across the project. Review the new API changes in react-redux to ensure there are no unintended side effects.

suite-native/device-authorization/package.json (2)

14-14: Updated @reduxjs/toolkit Dependency Version
The dependency has been bumped to "2.6.0", matching the new major version upgrade. Confirm that all Redux-related middleware and reducers integrate well with this change.


24-24: Updated react-redux Dependency Version
The react-redux version is now "9.2.0". Please verify that any usage of react-redux hooks or connect functions conforms to the latest API requirements.

suite-native/module-staking-management/package.json (2)

14-14: Updated @reduxjs/toolkit Dependency Version
Changing the toolkit version to "2.6.0" is part of the coordinated upgrade. Ensure that any store configurations or middleware setups are compatible with the new version.


26-26: Updated react-redux Dependency Version
Upgrading to "9.2.0" should be double-checked against component connections to ensure that expected behavior is maintained.

suite-common/firmware/package.json (2)

13-13: Updated @reduxjs/toolkit Dependency Version
The dependency version has been updated to "2.6.0". This change should bring new features and improvements; however, please verify that any Redux middleware or enhancers in the firmware module are still functioning as intended.


21-21: Updated react-redux Dependency Version
The update to "9.2.0" is in line with the overall project upgrade. Make sure to test connected components for any potential breaking changes in react-redux's API.

suite-native/module-send/package.json (2)

16-16: Updated @reduxjs/toolkit Dependency Version
The change to "2.6.0" is consistent with the project-wide dependency update. Ensure that the Redux store and slices used in this module are compatible with the new version.


56-56: Updated react-redux Dependency Version
The dependency has been updated to "9.2.0". Please review any hooks or component connections utilizing react-redux to confirm they work as expected with the new version.

suite-native/message-system/package.json (2)

14-14:

❓ Verification inconclusive

Major version upgrade of @reduxjs/toolkit detected.

This is a significant upgrade from v1.9.5 to v2.6.0 of @reduxjs/toolkit. Redux Toolkit 2.0 introduced several breaking changes including:

  • Changes to middleware typing
  • Updates to createSlice API
  • Changes to RTK Query

Ensure that your application code has been updated to accommodate these breaking changes.


🌐 Web query:

What are the breaking changes in Redux Toolkit 2.0?

Error during web search


Attention: Verify Redux Toolkit v2.6.0 Upgrade Adjustments

The dependency for Redux Toolkit in suite-native/message-system/package.json has been updated from v1.9.5 to v2.6.0. Redux Toolkit v2 introduces breaking changes—including modifications to middleware typing, updates to the createSlice API, and changes affecting RTK Query. Due to recent difficulties retrieving detailed web search results for the official breaking changes, please review the official Redux Toolkit release notes and changelog to confirm all necessary code updates.

  • File: suite-native/message-system/package.json (Line 14)
  • Action Required:
    • Confirm that middleware usage aligns with the new typing requirements.
    • Verify that calls to createSlice are updated per the new API specifications.
    • Ensure that any RTK Query integrations are modified as needed to work with the updated version.

29-29:

❓ Verification inconclusive

Major version upgrade of react-redux detected.

This is a significant upgrade from v8.0.7 to v9.2.0 of react-redux. React Redux 9.0 introduced breaking changes particularly around TypeScript types, hooks, and component APIs.

Make sure the codebase has been updated to match the new API requirements.


🌐 Web query:

What are the breaking changes in React Redux 9.0?

Error during web search


I'm generating a new web search query to gather the official list of breaking changes introduced in React Redux v9 before finalizing this review comment.

What are the official breaking changes introduced in React Redux version 9.0 according to its release notes?

Once you have the results:

  • Verify that the changes in TypeScript definitions, hook behavior, and component APIs have been addressed throughout the codebase.
  • Confirm that the upgrade from v8.0.7 to v9.2.0 in suite-native/message-system/package.json is fully synchronized with these updates.
suite-native/accounts/package.json (2)

16-16: Major version upgrade of @reduxjs/toolkit detected.

This is a significant upgrade from v1.9.5 to v2.6.0 of @reduxjs/toolkit. Redux Toolkit 2.0 introduced several breaking changes including middleware handling, RTK Query changes, and TypeScript typing updates.

Ensure that all components using Redux functionality in this package have been properly updated to accommodate these changes.


44-44: Major version upgrade of react-redux detected.

This upgrade from v8.0.7 to v9.2.0 of react-redux contains breaking changes, particularly with TypeScript typing and hook behavior.

Verify that all components using hooks like useSelector and useDispatch have been updated to work with the new version.

packages/suite-desktop-connect-popup/package.json (2)

12-12: Major version upgrade of @reduxjs/toolkit detected.

This is a significant upgrade from v1.9.5 to v2.6.0 of @reduxjs/toolkit with several breaking changes. Ensure that the suite-desktop-connect-popup application has been thoroughly tested with this new version.


25-25:

❓ Verification inconclusive

Major version upgrade of redux-thunk detected.

The upgrade from redux-thunk v2.4.2 to v3.1.0 includes significant changes. In Redux Toolkit 2.x, redux-thunk is already included, so this dependency might be redundant unless you're using it directly.

Consider whether this dependency is still needed with the upgraded Redux Toolkit.


🌐 Web query:

Is redux-thunk v3 compatible with Redux Toolkit 2.x? Is it still needed?

Error during web search


Below is an updated review comment incorporating your observations and suggestions. Since the web query returned an error, please verify directly that redux-thunk isn’t being used in a way that justifies having it as a separate dependency.

Redux-thunk Dependency Review:
The dependency upgrade from redux-thunk v2.4.2 to v3.1.0 is a major version change and comes with significant modifications. Considering Redux Toolkit 2.x includes redux-thunk by default, this direct dependency appears redundant unless you’re explicitly importing or configuring redux-thunk in your code.

  • Action: Check the codebase for any direct usage of redux-thunk:
    • If found, ensure that the upgrade doesn’t introduce compatibility issues.
    • If not used directly, consider removing the dependency to simplify maintenance and avoid potential conflicts.
suite-native/test-utils/src/StoreProviderForTests.tsx (1)

12-12:

✅ Verification successful

Appropriate type relaxation for test state setup

Changing preloadedState from PreloadedState to Partial<PreloadedState> is a logical improvement that makes the test utility more flexible. This allows test authors to specify only the relevant parts of the state they care about, rather than having to construct a complete state object.

This change aligns well with the Redux upgrade, as Redux toolkit v2.x encourages working with partial state for greater flexibility.


🏁 Script executed:

#!/bin/bash
# Check implementation of initStore to confirm it properly handles partial state
grep -r 'export const initStore' --include="*.ts" --include="*.tsx" ./

Length of output: 240


Test State Flexibility Verified

The change to use Partial<PreloadedState> in suite-native/test-utils/src/StoreProviderForTests.tsx correctly relaxes the expected state type for testing purposes. The grep results confirm that the initStore functions in the codebase accept a preloaded state (even though they’re still typed as PreloadedState), which indicates that test utilities can rely on internally merging default values. This aligns well with Redux Toolkit v2.x’s recommendations for more flexible, partial state setup in tests.

suite-native/module-accounts-management/package.json (1)

16-16:

❓ Verification inconclusive

Major Redux version upgrades require careful testing

You've upgraded from Redux Toolkit 1.9.5 to 2.6.0 and React Redux 8.0.7 to 9.2.0, which are significant version jumps that include breaking changes. This appears to be part of a coordinated upgrade across the entire codebase.

These new versions provide improved TypeScript support and performance enhancements, but ensure you've thoroughly tested the application, particularly focusing on:

  1. Redux middleware functionality
  2. Connected components that rely on useSelector and useDispatch
  3. Any custom selectors or action creators

Also applies to: 45-45


🌐 Web query:

What are the breaking changes between Redux Toolkit v1.9 and v2.6?

Error during web search


Attention: Major Redux Upgrade – Manual Verification Recommended

The upgrade from Redux Toolkit v1.9.5 to v2.6.0 (and React Redux from v8.0.7 to v9.2.0) introduces significant changes that might affect your app’s behavior. While we see improvements in TypeScript support and performance, please verify the following thoroughly:

  • Redux Middleware: Ensure all middleware, both built-in and custom, continues to function as expected.
  • Connected Components: Confirm that components relying on useSelector and useDispatch are not impacted.
  • Custom Selectors/Action Creators: Double-check any custom implementations for compatibility.

Note: A web query to detail the breaking changes between these versions returned an error. Please consult the official Redux Toolkit and React Redux release notes/changelog to review specific breaking changes.

Also applies to line 45 in the file.

packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts (1)

34-34:

❓ Verification inconclusive

Improved type inference with Redux v2

Removing the explicit as Action type casts is a positive change. Redux Toolkit v2 has significantly improved type inference capabilities, making these explicit casts unnecessary.

The code is now cleaner while maintaining the same type safety through automatic inference. This aligns with TypeScript best practices by letting the compiler do more of the work.

Also applies to: 50-50, 66-66, 81-81, 117-117, 132-132, 147-147


🏁 Script executed:

#!/bin/bash
# Check if the fixtures file structure matches the expected pattern
# to ensure the types are consistent with what the tests expect
grep -A 10 "export default" '../__fixtures__/deviceReducer.ts' || echo "Fixtures file not found"

Length of output: 185


Action Required: Verify Fixture File Availability in Tandem with Type Inference Improvements

The removal of the explicit as Action casts to leverage Redux Toolkit v2’s improved type inference is a welcome simplification that keeps type safety intact. However, during verification the expected fixture file (../__fixtures__/deviceReducer.ts) wasn’t found, so please double-check whether this file’s absence is intentional or if tests require an update. Also, ensure that the changes affecting lines 34, 50, 66, 81, 117, 132, and 147 are consistent with the revised test fixture structure.

  • Verify if the missing fixture file is an oversight or if it was removed as part of the refactor.
  • Confirm that tests relying on device reducer state (e.g., in packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts) still behave as expected without the fixture.
suite-common/redux-utils/package.json (1)

14-14:

❓ Verification inconclusive

Comprehensive Redux stack upgrade

The update includes three major library upgrades:

  • Redux Toolkit from 1.9.5 to 2.6.0
  • React Redux from 8.0.7 to 9.2.0
  • Redux core from 4.x to 5.x

This is a substantial change that likely affects the entire application. Since this is in a common utilities package, it will propagate throughout the codebase.

These updates bring better TypeScript support, improved performance, and modern Redux patterns, but should be accompanied by comprehensive testing.

Also applies to: 23-24


🏁 Script executed:

#!/bin/bash
# Check for common redux-utils exports to ensure they're properly updated for v5
echo "Checking for potential breaking changes in redux-utils exports"
grep -r "export " --include="*.ts" --include="*.tsx" ./src/

Length of output: 236


🌐 Web query:

What are the key breaking changes in Redux v5.0?

Error during web search


Action Required: Verify Redux Stack Upgrade Impact Across the Codebase

The upgrade—from Redux Toolkit 1.9.5 to 2.6.0, React Redux 8.0.7 to 9.2.0, and Redux core 4.x to 5.x—is significant and likely affects many parts of the application. Note that the initial automated check failed due to targeting a non-existent ./src/ directory. Additionally, the query for key Redux v5 breaking changes did not yield any usable information.

  • Ensure that all exports in the suite-common/redux-utils package are compatible with the updated Redux core version. Since the earlier script targeted the wrong directory, please verify manually or update the search to cover the correct paths.
  • Review Redux v5 documentation or release notes to identify any breaking changes that may impact the application.
  • Perform comprehensive testing across the codebase to catch any regressions caused by these dependency upgrades.
suite-common/test-utils/package.json (3)

24-24: Redux-thunk upgrade to version 3

This updates redux-thunk from 2.4.2 to 3.1.0, which will require changes to how the middleware is imported and used.


23-23:

❓ Verification inconclusive

Major version upgrade to Redux

The upgrade from Redux 4.2.1 to 5.0.1 introduces significant changes to the Redux core. Redux 5 represents a major rewrite with improved TypeScript support.


🌐 Web query:

What are the breaking changes in Redux 5.0 compared to Redux 4.x?

Error during web search


Verify Redux 5 Upgrade Impact

The major version bump from Redux 4.2.1 to 5.0.1 is expected to introduce breaking changes—especially given the core rewrite and improved TypeScript support. However, the web search query intended to detail these breaking changes returned an error. Please manually verify the upgrade’s impact on our codebase by checking if usage of Redux (e.g., middleware, enhancers, and store configurations) still adheres to the updated API expectations.

  • File: suite-common/test-utils/package.json (Line 23)
    • "redux": "^5.0.1",

Since the exact breaking changes were not retrieved, review all integrations with Redux to ensure compatibility.


14-14:

❓ Verification inconclusive

Significant version upgrade to @reduxjs/toolkit

The update from 1.9.5 to 2.6.0 represents a major version change that includes breaking changes in RTK API. This aligns with the PR objective of upgrading Redux dependencies.


🌐 Web query:

What are the major breaking changes between @reduxjs/toolkit 1.9.5 and 2.6.0?

Error during web search


ACTION: Confirm API compatibility for RTK major upgrade

The update from version 1.9.5 to 2.6.0 of @reduxjs/toolkit is a major version change that may introduce breaking changes in the RTK API. Although the PR’s objective is to upgrade Redux dependencies, please ensure that our usage of RTK (e.g., in APIs like createSlice, createAsyncThunk, etc.) is fully compatible with the new version. Since the web query for detailed breaking change information did not return results, it is essential to manually verify the changes by reviewing the official Redux Toolkit changelog and documentation.

  • File: suite-common/test-utils/package.json, Line 14 – the version bump here should be cross-checked against our RTK usage.

Please review the RTK documentation (or changelog) for specifics on breaking changes, and update any affected code as necessary.

packages/connect-explorer/src/store/index.ts (1)

3-3: Updated thunk import to use named import

The change from default to named import reflects the API change in redux-thunk v3.x, which exports thunk as a named export instead of a default export.

suite-native/module-trading/src/hooks/__tests__/useReceiveAccountsListData.test.tsx (2)

9-9: Added import for StaticSessionId type

This import is necessary to support the type assertions added to the test file.


18-18: Added type assertion for staticSessionId

The string value 'staticSessionId' is now properly typed as StaticSessionId, improving type safety with the Redux 5.x upgrade. This change appears at two locations in the file.

This change helps address the stricter type requirements in the upgraded Redux, ensuring that the staticSessionId is correctly typed for Redux state.

Also applies to: 188-188

packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts (2)

13-13: Added Dispatch type import

The Dispatch type is now imported alongside Action, enabling proper typing of dispatch functions.


47-49: Improved dispatch typing and async handling

These changes improve type safety and async behavior by:

  1. Explicitly casting store.dispatch to the Dispatch type
  2. Creating a local dispatch variable for cleaner code
  3. Properly awaiting the connectInitThunk for sequential execution
  4. Using the dispatch variable for subsequent actions

These modifications are necessary to work with the stricter typing in Redux 5.x and ensure correct async flow in the test.

suite-native/module-trading/package.json (3)

15-15:

❓ Verification inconclusive

Redux Toolkit major version update may require additional application changes

The update from Redux Toolkit 1.9.5 to 2.6.0 represents a significant major version jump. This update likely introduces breaking changes that may require additional adjustments throughout the codebase.


🌐 Web query:

What are the breaking changes in @reduxjs/toolkit from version 1.9.5 to 2.6.0?

Error during web search


Action Required: Verify Redux Toolkit Upgrade Compatibility

The dependency update in suite-native/module-trading/package.json bumps Redux Toolkit from 1.9.5 to 2.6.0—a significant major version jump. Although the web search for breaking changes returned an error, please be aware that such upgrades may introduce breaking changes. We recommend the following:

  • Review the official Redux Toolkit release notes for v2.0+ to identify any breaking changes that might impact existing code.
  • Manually test Redux Toolkit usages (e.g., slices, thunks, middleware) across the codebase to ensure compatibility, as core functionality changes may require adjustments.
  • Pay special attention to integration points where the toolkit interacts with your Redux store and middleware setups.

19-19:

❓ Verification inconclusive

New dependency added

The new @trezor/connect dependency has been added. Ensure that this dependency is properly used in the codebase and that its addition is necessary for the Redux upgrade.


🏁 Script executed:

#!/bin/bash
# Verify if the @trezor/connect dependency is used in this module

# Look for imports of @trezor/connect in the module's source files
fd -t f -e ts -e tsx . suite-native/module-trading/src | xargs grep -l "@trezor/connect" || echo "No direct imports found"

Length of output: 172


Dependency Usage Verification for Redux Upgrade

The @trezor/connect dependency was detected in one test file:

  • suite-native/module-trading/src/hooks/__tests__/useReceiveAccountsListData.test.tsx

Please verify whether this usage in tests aligns with the Redux upgrade strategy. If production code also needs to utilize this dependency, ensure that it is integrated accordingly. Otherwise, confirm that the inclusion solely for testing is intentional and necessary.


24-24:

❓ Verification inconclusive

React-Redux major version update may require component updates

The update from react-redux 8.0.7 to 9.2.0 is a major version jump that might require changes to how components connect to the Redux store and how hooks are used.


🌐 Web query:

What are the breaking changes in react-redux from version 8.0.7 to 9.2.0?

Error during web search


Action Required: Verify React-Redux Breaking Changes

The dependency update in suite-native/module-trading/package.json bumps react-redux from 8.0.7 to 9.2.0—a major version jump that could introduce breaking changes affecting how components connect to the Redux store and how hooks are implemented. However, the web search to retrieve specific breaking changes failed. Please verify the potential impact by consulting the official React-Redux changelog or release notes for version 9.2.0. It's important to ensure that any modifications in component integration (e.g., usage of the connect API or hooks) are aligned with the updated library API.

  • File Affected: suite-native/module-trading/package.json (Line 24)
  • Action: Confirm and adjust the component updates as needed by reviewing the official changelog for react-redux v9.2.0.
suite-common/redux-utils/src/hooks/useSelectorDeepComparison.ts (2)

12-12: Added TypeScript utility from base hook

Adding withTypes property exposes the TypeScript utility from the base useSelector hook, improving type safety when using this custom hook.


5-10:

✅ Verification successful

Simplified selector hook aligns with updated Redux patterns

The function signature has been simplified by removing the equalityFn parameter, and the comparison logic now relies directly on isEqualWith without custom comparison functions.

This change aligns with modern Redux patterns and improves type safety, but ensure that this doesn't break existing custom comparison logic that might have been used elsewhere.


🏁 Script executed:

#!/bin/bash
# Check for usages of this hook with two parameters which would now break

fd -t f -e ts -e tsx . -E node_modules | xargs grep -l "useSelectorDeepComparison.*," | xargs grep -A 1 "useSelectorDeepComparison" || echo "No potential issues found"

Length of output: 192


Selector Hook Simplification Verified

The updated useSelectorDeepComparison hook now omits the extra equalityFn parameter and relies solely on isEqualWith for deep comparisons. Our verification script confirmed that no usages depend on a two-parameter signature, indicating that this change aligns well with updated Redux patterns without breaking existing custom comparison logic.

  • The function signature simplification is safe as no legacy usages were detected.
  • Modern Redux patterns are upheld, and type safety is improved.
suite-common/trading/src/thunks/buy/__tests__/handleRequestThunk.test.ts (1)

71-80: Enhanced AbortSignal mock for improved test fidelity

The mock implementation of AbortSignal has been significantly improved to better match the actual interface. This change improves test reliability by:

  1. Providing all expected interface methods and properties
  2. Ensuring type compatibility with the real AbortSignal
  3. Making tests more resilient against changes in how AbortSignal is used

This enhancement is particularly important when upgrading dependencies like Redux, as the new versions may have stricter type checking or handle AbortController/AbortSignal differently.

suite-native/device/src/utils.ts (2)

1-54:

✅ Verification successful

Removed isAnyDeviceEventAction function

The isAnyDeviceEventAction function has been removed from this file. According to the AI summary, it has been moved to suite-common/suite-utils/src/device.ts. This relocation centralizes device-related utilities and type guards.

Ensure that all references to this function in other files have been updated to use the new import location.


🏁 Script executed:

#!/bin/bash
# Check for any remaining imports of isAnyDeviceEventAction from this file location

fd -t f -e ts -e tsx . -E node_modules | xargs grep -l "import.*isAnyDeviceEventAction.*from.*device/src/utils" || echo "No references to old import location found"

# Verify that the function exists in the new location
fd -t f -e ts . -p "suite-common/suite-utils/src" | xargs grep -l "isAnyDeviceEventAction" || echo "Function not found in the expected new location"

Length of output: 336


Function Relocation Confirmed:
The removal of the isAnyDeviceEventAction function from suite-native/device/src/utils.ts is verified—no files reference it from this location, and the function is correctly present in suite-common/suite-utils/src/device.ts. Please ensure that any usage of this function now points to the new location.


4-6:

✅ Verification successful

Updated import source for AnyAction and added DeviceEvent type

The import source for AnyAction has been changed from @reduxjs/toolkit to @suite-common/redux-utils, and the DeviceEvent type import has been added.

This likely reflects a reorganization of types as part of the Redux upgrade, centralizing Redux-related types in your internal utilities. Ensure that the AnyAction type in the new location is compatible with the one from Redux Toolkit to prevent type issues.


🏁 Script executed:

#!/bin/bash
# Check if the AnyAction type in @suite-common/redux-utils is properly defined and exported

fd -t f -e ts . -p "suite-common/redux-utils" | xargs grep -l "export.*AnyAction" || echo "AnyAction type not found in suite-common/redux-utils"

Length of output: 119


Type Verification Confirmed: Redux Types Are Properly Updated

The AnyAction type is now imported from @suite-common/redux-utils and is correctly exported (as confirmed by the presence of the export in suite-common/redux-utils/src/types.ts). Additionally, the new import for the DeviceEvent type has been added according to the updated organizational structure. Ensure that any compatibility nuances with the Redux Toolkit version of AnyAction are reviewed, but the change appears sound.

suite-common/suite-utils/src/device.ts (3)

1-1: Good addition of the AnyAction import

The import of AnyAction from '@suite-common/redux-utils' is appropriate for the new type guard function added below.


3-10: Enhanced import statement with specific types

The expanded import from '@trezor/connect' now explicitly imports DEVICE and DeviceEvent, which improves code clarity by making the dependencies more obvious.


454-455: Solid type guard implementation for device actions

The new isAnyDeviceEventAction function provides a valuable type guard that narrows down Redux actions to the DeviceEvent type. This improves type safety when handling device-related actions throughout the application.

The implementation correctly:

  1. Checks if the action's type is included in the values of the DEVICE enum
  2. Uses TypeScript's type predicate syntax (action is DeviceEvent) for proper type narrowing

This function will be particularly useful in Redux middleware and reducers that need to handle device events.

suite-native/state/package.json (3)

48-48: Type definitions update for redux-logger

Minor update to redux-logger type definitions from 3.0.11 to 3.0.13. This is a low-risk change that updates type definitions without altering runtime behavior.


42-42:

❓ Verification inconclusive

Major update to react-redux - verify component connections

This is a significant version upgrade from 8.0.7 to 9.2.0 which includes breaking changes in the react-redux API.

Major changes in react-redux 9.0 include:

  • Updated TypeScript types
  • Changes to how components connect to the store
  • Updates to hooks API

Make sure all components using connect() or Redux hooks have been properly migrated.


🌐 Web query:

What are the breaking changes in react-redux 9.0?

Error during web search


Verify react-redux 9.x Breaking Changes and Component Connections

The package change to "react-redux": "9.2.0" in suite-native/state/package.json indicates a major upgrade from version 8.0.7. This update brings breaking changes—particularly affecting TypeScript type definitions, the way components connect via connect(), and updates to the hooks API.

However, our attempt to automatically retrieve detailed breaking change information via a web query encountered an error. As a result, please ensure that:

  • Component Connections: All components using connect() are revised to accommodate any changes in the new API.
  • Redux Hooks: Verify that any usage of Redux hooks conforms to the updated requirements.
  • Cross-check Official Documentation: In the absence of automated details, refer to the official react-redux documentation for thorough guidance on the breaking changes introduced in version 9.x.

Manual verification of these areas is advised to ensure compatibility and correct implementation.


13-13:

❓ Verification inconclusive

Major upgrade of Redux Toolkit - verify compatibility

This is a significant version upgrade from 1.9.5 to 2.6.0 which includes breaking changes in the Redux Toolkit API.

Key changes in RTK 2.0 include:

  • New TypeScript types
  • Changes to middleware setup
  • Updated createSlice API
  • Improved immer integration

Ensure all components using RTK have been properly migrated to the new API.


🌐 Web query:

What are the breaking changes in Redux Toolkit 2.0?

Error during web search


Action: Verify Redux Toolkit 2.6.0 Migration Compatibility

The upgrade from RTK 1.9.5 to 2.6.0 comes with notable breaking changes that require manual verification. In particular, please ensure that:

  • All usages of RTK APIs (e.g., createSlice, configureStore, and any associated middleware configuration) in the codebase have been updated to reflect the RTK 2.x changes.
  • Any custom TypeScript types or middleware setups incorporate the revised typings and configuration patterns introduced in RTK 2.0.
  • Components relying on RTK functionality have been tested to confirm that updated immer integration and changes to slice creation do not introduce regressions.

Given that the automated web lookup for breaking changes resulted in an error, please double-check against the official Redux Toolkit documentation for RTK 2.x to verify compatibility.

packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts (1)

52-52: Improved code with type inference

Simplifying the middlewares declaration by removing the explicit Middleware<any, any>[] type annotation is a good practice. TypeScript can correctly infer the type from the array contents, resulting in cleaner code without sacrificing type safety.

This change aligns with modern TypeScript best practices of favoring type inference when the types are clear from context.

packages/connect-explorer/package.json (4)

40-40: Major update to react-redux

Upgrade from react-redux 8.0.7 to 9.2.0 is a significant change that includes breaking changes to the API. Ensure that all components using react-redux hooks and connect() have been properly updated.

See the verification query in the suite-native/state/package.json review about react-redux 9.0 breaking changes.


51-51: Type definitions update for redux-logger

Minor update to redux-logger type definitions from 3.0.11 to 3.0.13. This change updates only type definitions without altering runtime behavior.


41-41:

❓ Verification inconclusive

Major version bump for Redux core

Upgrade from Redux 4.x to 5.x includes significant changes, especially to TypeScript types and internal implementations. The Redux 5.0 update focuses on modernizing the codebase, improving TypeScript support, and removing legacy APIs.

This change may require updates to custom middleware, store setup, and action creators.


🌐 Web query:

What are the breaking changes in Redux 5.0?

Error during web search


Attention: Redux 5.0 Upgrade Impact

  • The upgrade from Redux 4.x to 5.0 introduces considerable changes—notably in TypeScript typings and internal implementations—which may affect areas like custom middleware, store setup, and action creators.
  • Since the web query for detailed breaking changes in Redux 5.0 failed, please double-check the official Redux 5.0 release notes and documentation to verify any additional modifications that might impact our codebase.

43-43:

❓ Verification inconclusive

Major update to redux-thunk

Upgrade from redux-thunk 2.x to 3.x is significant. Redux Thunk 3.0 introduces ESM support and has changes to how the middleware is imported and configured.

If you were previously using default imports like import thunk from 'redux-thunk', you'll need to update to named imports like import { thunk } from 'redux-thunk'.


🏁 Script executed:

#!/bin/bash
# Check for any remaining default imports of redux-thunk
rg -t ts -t tsx "import thunk from 'redux-thunk'" --no-filename

Length of output: 99


Manual Verification Needed for Redux Thunk Imports

The original search using rg -t ts -t tsx "import thunk from 'redux-thunk'" produced an error because the TSX file type wasn’t recognized. This prevents us from confirming that no default imports remain. Please re-run the check with a revised command that targets TS and TSX files explicitly:

If this search shows no default imports, you can safely proceed with the upgrade guidance to convert any previous default imports to named imports (i.e. use import { thunk } from 'redux-thunk').


🏁 Script executed:

#!/bin/bash
# Re-run search for default imports of redux-thunk in both TS and TSX files
rg -g "*.ts" -g "*.tsx" "import thunk from 'redux-thunk'" --no-filename

Length of output: 201


Manual Verification Pending for Redux Thunk Import Update

The revised search command aimed at locating default imports did not clearly confirm whether any instances exist. There appears to be ambiguity due to the command-line artifact (: command not found). Please manually verify that no TS or TSX file still uses the default import syntax, i.e.,

import thunk from 'redux-thunk'

and confirm that all imports have been updated to the new named import syntax:

import { thunk } from 'redux-thunk'
  • Action Required: Manually check or re-run the command in your environment (without the `` artifact) to ensure that the import statements are updated correctly.

Manual Verification Required: Redux Thunk Import Update

Please verify that no TS/TSX files use the legacy default import

import thunk from 'redux-thunk'

and that all such imports have been updated to the named import syntax:

import { thunk } from 'redux-thunk'

While the automated search did not report any default imports, the command produced an artifact error. I recommend manually confirming this change in your codebase to ensure complete compliance with Redux Thunk 3.x changes.

packages/suite/src/middlewares/suite/suiteMiddleware.ts (2)

1-1: Import adjustments for Redux upgrade look good

The imports have been updated to accommodate the Redux upgrade. Moving AnyAction import from @reduxjs/toolkit to @suite-common/redux-utils and adding the isAnyDeviceEventAction utility function import are appropriate changes.

Also applies to: 4-5


46-46: Good simplification of device event action detection

Replacing the previous implementation that used Object.values(DEVICE).includes(action.type) with the specialized utility function isAnyDeviceEventAction improves code readability and maintainability. This is a good refactoring that centralizes the device event detection logic.

suite-native/device/src/middlewares/deviceMiddleware.ts (2)

4-4: Good move to use shared utility function

Importing isAnyDeviceEventAction from the common module @suite-common/suite-utils instead of local utilities improves code consistency across the codebase. This is a positive change for maintainability.

Also applies to: 22-22


41-41: Simplified device event action detection

Using isAnyDeviceEventAction(action) directly for the final check streamlines the code and leverages the common utility function appropriately.

packages/suite/src/support/tests/configureStore.tsx (3)

1-4: Import updates for Redux Toolkit 2.x and Redux Thunk 3.x

The imports have been updated to match the new Redux libraries structure. Importing withExtraArgument directly from 'redux-thunk' is the correct approach for the updated library.


23-23: Correct update to thunk middleware application

The middleware configuration has been correctly updated to use the new Redux Thunk API, using withExtraArgument directly instead of thunk.withExtraArgument.


17-23:

❓ Verification inconclusive

Consider alternatives to the deprecated module

The file has a deprecation notice recommending the use of configureStore from @suite-common/test-utils instead. However, the implementation is still being updated for the Redux upgrade.


🏁 Script executed:

#!/bin/bash
# Check if @suite-common/test-utils is available and contains configureStore
fd -t f "configureStore" --include-hidden --full-path -E "node_modules" | grep "@suite-common/test-utils"

Length of output: 382


Action Required: Verify Alternative Implementation for Store Configuration

  • The deprecation notice still in packages/suite/src/support/tests/configureStore.tsx advises using configureStore from @suite-common/test-utils instead, but we couldn’t confirm its presence due to an issue with the search command (--include-hidden flag error).
  • Please re-run the search with corrected flags (e.g., using --hidden instead) or perform a manual verification to ensure that the alternative module actually provides the required configureStore implementation.
  • Confirming the presence and readiness of @suite-common/test-utils is essential before removing or further modifying the deprecated code.
🧰 Tools
🪛 Biome (1.9.4)

[error] 20-20: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

suite-native/state/src/store.ts (2)

12-12: Improved type definitions for store state

The addition of DeepPartial and the new type definitions for the store state improve type safety by ensuring that preloaded state can be deeply partially defined, which is more flexible and accurate.

Also applies to: 18-19


55-55: Correct update to enhancers configuration

The enhancers configuration has been properly updated to use the new Redux Toolkit API pattern, which now expects a function that receives the default enhancers getter function.

suite-common/redux-utils/src/types.ts (4)

1-5: Good replacement of AnyAction import with Action

The import change from AnyAction to Action is appropriate for Redux Toolkit 2.x, which has restructured some of its exports. This is a necessary step when upgrading to the newer version.


3-5: Well-defined AnyAction interface

Creating a custom AnyAction interface that extends the standard Action is a good approach for maintaining backward compatibility with existing code that expects the looser typing of AnyAction from Redux 4.x.


17-24: Well-designed type guard utilities

The introduction of TypeGuard, HasMatchFunction, and Matcher types creates a robust foundation for type-safe action matching patterns. This aligns with Redux Toolkit's design philosophy of enabling strong type inference.


37-40: Excellent utility for extracting action types

The ActionsFromAsyncThunk type is a smart utility that extracts all possible action types from an async thunk. This enables type-safe handling of all states of an async operation (pending, fulfilled, rejected) when working with reducers or selectors.

packages/suite/package.json (5)

113-115: Comprehensive core Redux library updates

Upgrading Redux from 4.2.1 to 5.0.1 and Redux Thunk from 2.4.2 to 3.1.0 is a significant change that requires the type adjustments you've made in global.d.ts. These dependencies form a coherent set of versions that should work well together.


139-140: Updated typings for Redux devtools

The updates to @types/redux-logger and @types/redux-mock-store complement the core Redux upgrades. This ensures that development tooling remains compatible with the new Redux versions.


92-92:

✅ Verification successful

Verify Immer 10.x compatibility

Upgrading from Immer 9.x to 10.x introduces some changes, particularly around ES modules and TypeScript types. Ensure that all imports for the 'produce' function use the correct pattern for the new version.


🏁 Script executed:

#!/bin/bash
# Check for Immer usage patterns

# Look for default imports of 'produce' that would need to be changed to named imports
echo "Checking for Immer default imports:"
rg "import (produce|default as produce) from ['\"]immer['\"]" --type ts

# Look for existing produce usage
echo "Checking for produce usage patterns:"
rg "produce\(" -A 1 --type ts

Length of output: 3045


Immer 10.x Compatibility Verified

I reviewed the code and confirmed that none of the TypeScript files use the deprecated default import style for produce. Instead, the current usage across multiple reducers (e.g., in onboardingReducer.ts, backupReducer.ts, etc.) is consistent with the named import pattern required by Immer 10.x. The package version in packages/suite/package.json has been updated to "immer": "10.1.1", and no legacy import patterns were detected.

Please continue to maintain the named import style (import { produce } from 'immer') in all new code to ensure ongoing compatibility.


26-26:

❓ Verification inconclusive

Verify Redux Toolkit 2.x compatibilities

Upgrading from Redux Toolkit 1.9.5 to 2.6.0 includes several breaking changes. Make sure to check if all RTK Query usages and createEntityAdapter implementations have been updated to handle the new API changes.


🏁 Script executed:

#!/bin/bash
# Check for potential incompatibilities with RTK 2.x

# Search for RTK Query API usage
echo "Checking for RTK Query usages:"
rg -A 2 "createApi|fetchBaseQuery" --type ts

# Check for entity adapter usages
echo "Checking for entity adapters:"
rg -A 2 "createEntityAdapter" --type ts

# Check for usage of deprecated APIs
echo "Checking for potentially deprecated APIs:"
rg "getDefaultMiddleware|configureStore.*middleware" --type ts

Length of output: 1849


Action: Confirm RTK 2.x Middleware and API Usages

  • The upgrade to Redux Toolkit 2.6.0 was checked for breaking changes. No instances of RTK Query (createApi/fetchBaseQuery) or createEntityAdapter were found in the codebase.
  • Several calls to getDefaultMiddleware (in store configuration and test files) remain. Please review these usages to ensure that any changes in default middleware behavior in RTK 2.x are properly addressed.

105-105:

❓ Verification inconclusive

Check React Redux 9.x compatibility

The upgrade from React Redux 8.0.7 to 9.2.0 might require changes to how hooks like useSelector and useDispatch are used, especially with TypeScript. Verify that all components using these hooks still compile correctly.


🏁 Script executed:

#!/bin/bash
# Check for React Redux hooks usage

# Look for useSelector hooks
echo "Checking for useSelector usages:"
rg "useSelector\(" -A 1 --type ts

# Look for useDispatch hooks
echo "Checking for useDispatch usages:"
rg "useDispatch\(" -A 1 --type ts

# Check for connect HOC usage (which might need updates)
echo "Checking for connect HOC usages:"
rg "connect\(" -A 2 --type ts

Length of output: 86507


React Redux 9.x Hook Usage Verification – Please Confirm TypeScript Compilation

The dependency in packages/suite/package.json has been updated to “react-redux”: “9.2.0”. Our grep search shows that the standard hook patterns (e.g. useSelector and useDispatch) are used extensively and in a consistent manner across the codebase. There are no obvious patterns indicating the need for API adjustments due to the upgrade.

However, because React Redux 9.x can have subtle TypeScript implications, please manually verify (or run a TypeScript compilation) that all components using these hooks compile without issues.

suite-common/wallet-core/src/send/sendFormThunks.ts (6)

4-4: Good import consolidation

Combining the import of ActionsFromAsyncThunk with createThunk improves code organization by grouping related functionality from the same module.


30-31: Enhanced type safety for TrezorConnect imports

Adding explicit imports for SuccessWithDevice and Unsuccessful types from @trezor/connect strengthens type safety when dealing with API responses.


133-136: Excellent type guard implementation

The implementation of isSuccessfullyPushedTransaction as a type guard is a clean, reusable approach that improves both code readability and type safety. This pattern aligns well with TypeScript best practices for narrowing types.


317-317: Type-safe response handling

Using the new type guard function here improves code clarity and type safety compared to directly checking the success property.


346-347: Simplified return statement with type guard

Using the type guard in the return statement enables TypeScript to properly narrow the union type, providing better type safety for the fulfillWithValue call.


368-368: Consistent type guard usage

Consistently applying the same type guard pattern across different functions in the file improves code predictability and maintainability.

packages/suite/global.d.ts (4)

1-4: Import necessary types for Redux compatibility

Importing these specific types from 'redux', 'redux-thunk', and the custom AnyAction from '@suite-common/redux-utils' provides the foundation for the compatibility layer between Redux 4.x and 5.x.


12-29: Good backward compatibility for bindActionCreators

The custom declaration for Redux's bindActionCreators function is well-documented and maintains compatibility with the older usage pattern in the suite. This is an appropriate approach during a migration phase.


34-38: Appropriate Dispatch interface override

Overriding the Dispatch interface to support ThunkAction and use AnyAction instead of UnknownAction handles the type changes in Redux 5 that would otherwise cause errors with existing code.


41-43: Necessary Action interface relaxation

Defining the Action interface to use a less strict type parameter (any instead of unknown) helps maintain compatibility with existing code that wasn't designed for the stricter typing in Redux 5.

packages/suite/src/reducers/store.ts (6)

3-10: Enhanced imports for Redux Toolkit

The imports have been expanded to include more specific types from Redux Toolkit, which is good for type safety and better TypeScript integration.


54-54: Improved naming and reference to action types

Renaming excludedActions to loggerExcludedActions makes the variable purpose clearer. Also updated to use the action type property from the action creator, which is more reliable.


85-90: Updated Redux DevTools terminology

Changed actionsBlacklist to actionsDenylist to align with the updated terminology in Redux DevTools, which is part of the industry-wide effort to use more inclusive language.


109-116: Improved type handling for merged state

The state merging now has a proper type cast to ensure TypeScript recognizes the merged state as an AppState. This improves type safety while maintaining the functionality.


118-126: Updated store configuration for Redux Toolkit

The store configuration has been updated to follow Redux Toolkit patterns:

  1. Proper type casting for the reducer
  2. Using the middleware setup function pattern
  3. Configuring thunk with extraArguments
  4. Explicit type assertion with as const for better type inference

56-83:

✅ Verification successful

Refactored middleware setup with improved organization

The middleware setup has been refactored into a dedicated function that provides better organization and conditional logic. This approach:

  1. Creates a clear separation of middleware components
  2. Conditionally adds logging only for non-codesign builds
  3. Properly types the middleware array for type safety
  4. No longer needs to explicitly include thunkMiddleware (as it's now handled by the toolkit)

🏁 Script executed:

#!/bin/bash
# Check if all referenced middleware arrays are correctly imported and defined
rg -A 2 "suiteMiddlewares|walletMiddlewares|onboardingMiddlewares|backupMiddlewares|recoveryMiddlewares" packages/suite/src/

Length of output: 1970


Middleware setup refactoring verified and approved

The refactored code cleanly organizes middleware components, applies conditional logic for including the logger only when appropriate, and properly types the middleware array. Our verification confirms that all referenced middleware arrays are correctly imported and defined in the codebase, and the removal of the explicit thunkMiddleware is in line with the Redux toolkit’s handling.

suite-common/test-utils/src/configureMockStore.ts (7)

3-7: Updated imports for Redux Toolkit compatibility

Renamed Middleware to RTKMiddleware to avoid type conflicts and added the direct import for configureStore from Redux Toolkit. This change aligns with the Redux upgrade.


10-10: Updated imports from redux-utils

Simplified imports and updated to use the common redux-utils package which maintains compatibility with the upgraded Redux version.


19-20: Updated type signatures for reducers and state

The type signature for rootReducer has been updated to Reducer<any, any, any> to match the new Redux Toolkit type definitions which include a third generic type parameter.


42-47: Improved null checking for action metadata

Enhanced the condition for checking action.meta to ensure it's a non-null object before attempting to access properties. This is a good defensive programming practice that helps prevent runtime errors.


49-61: Changed action metadata handling strategy

Instead of removing meta properties, the code now sets requestId and requestStatus to undefined. This approach:

  1. Preserves the structure of the action object
  2. Makes it easier to compare actions in tests
  3. Avoids potential side effects from deleting properties

78-78: Added type assertion for middleware concatenation

Added a type assertion to ensure the middleware array is properly typed as RTKMiddleware[]. This improves type safety while maintaining flexibility for testing.


86-86: Updated return type for getActions

Changed the return type of getActions to include an explicit cast to AnyAction[], which improves type safety and prevents potential type errors.

@Lemonexe Lemonexe self-requested a review March 7, 2025 07:19
Copy link
Contributor

@Lemonexe Lemonexe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all changes. It's unfortunate that a lot of typecasting is now necessary, so I took a stab at some of those. I did manage to find at least partial solution for several of them, see comments 💬. But most of the times I did not 😞

Overall great work, thanks a lot for taking the time! 🙌
I still want to try something, then I'll give approve

And in yarn.lock I can see that @reduxjs/toolkit, react-redux and redux-thunk are deduplicated, which is great 🎉

Copy link
Contributor

@Lemonexe Lemonexe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested briefly.
📝 When comments are resolved it looks good to go! 🚀

EDIT: comments can be resolved, I pushed 274c570 to implement them

@Lemonexe Lemonexe force-pushed the chore/upgrade-redux branch from cbd5868 to 274c570 Compare March 7, 2025 12:45
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/suite/global.d.ts (3)

53-55: Avoid using '{}' as a type

Using {} as a type is discouraged in TypeScript as it means "any non-nullable value" rather than "empty object" as often assumed.

    export interface Middleware<
-        _DispatchExt = {},
+        _DispatchExt = Record<string, unknown>,
        S = any,
        D extends Dispatch = Dispatch<AnyAction>,
    > {
🧰 Tools
🪛 Biome (1.9.4)

[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


41-58: Consider further reducing 'any' usage in Redux type definitions

While keeping compatibility with older Redux types, it would improve type safety to replace some any usages with more specific types like unknown.

    export interface Action<T = any> {
        type: T;
    }

    // Older types for MiddlewareApi and Middleware that are using AnyAction instead of UnknownAction

-    export interface MiddlewareAPI<D extends Dispatch = Dispatch<AnyAction>, S = any> {
+    export interface MiddlewareAPI<D extends Dispatch = Dispatch<AnyAction>, S = unknown> {
        dispatch: D;
        getState(): S;
    }

    export interface Middleware<
        _DispatchExt = Record<string, unknown>,
-        S = any,
+        S = unknown,
        D extends Dispatch = Dispatch<AnyAction>,
    > {
-        (api: MiddlewareAPI<D, S>): (next: Dispatch<AnyAction>) => (action: any) => any;
+        (api: MiddlewareAPI<D, S>): (next: Dispatch<AnyAction>) => (action: unknown) => unknown;
    }
🧰 Tools
🪛 Biome (1.9.4)

[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


61-61: Remove useless empty export

This empty export is redundant because there's already an import/export in the file.

-export {};
🧰 Tools
🪛 Biome (1.9.4)

[error] 60-61: This empty export is useless because there's another export or import.

This import makes useless the empty export.

Safe fix: Remove this useless empty export.

(lint/complexity/noUselessEmptyExport)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbd5868 and 274c570.

📒 Files selected for processing (38)
  • packages/connect-explorer/package.json (1 hunks)
  • packages/connect-explorer/src/store/index.ts (1 hunks)
  • packages/suite-desktop-connect-popup/package.json (2 hunks)
  • packages/suite-desktop-ui/package.json (1 hunks)
  • packages/suite-web/package.json (1 hunks)
  • packages/suite/global.d.ts (1 hunks)
  • packages/suite/package.json (4 hunks)
  • packages/suite/src/actions/suite/__tests__/storageActions.test.ts (1 hunks)
  • packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts (2 hunks)
  • packages/suite/src/middlewares/suite/__tests__/messageSystemMiddleware.test.ts (0 hunks)
  • packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts (1 hunks)
  • packages/suite/src/middlewares/suite/suiteMiddleware.ts (2 hunks)
  • packages/suite/src/reducers/backup/backupReducer.ts (1 hunks)
  • packages/suite/src/reducers/onboarding/onboardingReducer.ts (1 hunks)
  • packages/suite/src/reducers/recovery/recoveryReducer.ts (1 hunks)
  • packages/suite/src/reducers/store.ts (4 hunks)
  • packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts (7 hunks)
  • packages/suite/src/reducers/suite/desktopUpdateReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/index.ts (1 hunks)
  • packages/suite/src/reducers/suite/metadataReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/protocolReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/suiteReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/windowReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/accountSearchReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/cardanoStakingReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/coinjoinReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/formDraftReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/graphReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/receiveReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/settingsReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/tradingReducer.ts (1 hunks)
  • packages/suite/src/support/tests/configureStore.tsx (1 hunks)
  • suite-common/analytics/package.json (1 hunks)
  • suite-common/bluetooth/package.json (1 hunks)
  • suite-common/connect-init/package.json (2 hunks)
  • suite-common/device-authenticity/package.json (1 hunks)
  • suite-common/firmware/package.json (1 hunks)
  • suite-common/graph/package.json (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/suite/src/middlewares/suite/tests/messageSystemMiddleware.test.ts
🚧 Files skipped from review as they are similar to previous changes (34)
  • packages/suite/src/reducers/wallet/receiveReducer.ts
  • packages/suite/src/reducers/wallet/accountSearchReducer.ts
  • packages/suite/src/reducers/wallet/settingsReducer.ts
  • packages/suite/src/reducers/suite/suiteReducer.ts
  • packages/suite/src/reducers/wallet/tradingReducer.ts
  • packages/suite/src/reducers/onboarding/onboardingReducer.ts
  • packages/suite/src/reducers/suite/index.ts
  • packages/suite/src/reducers/recovery/recoveryReducer.ts
  • packages/suite/src/reducers/suite/protocolReducer.ts
  • packages/suite/src/middlewares/suite/tests/buttonRequestMiddleware.test.ts
  • packages/suite/src/reducers/suite/metadataReducer.ts
  • packages/suite/src/reducers/wallet/coinjoinReducer.ts
  • suite-common/bluetooth/package.json
  • suite-common/device-authenticity/package.json
  • packages/suite/src/reducers/suite/desktopUpdateReducer.ts
  • packages/suite/src/middlewares/suite/tests/redirectMiddleware.test.ts
  • packages/suite-desktop-ui/package.json
  • packages/suite-desktop-connect-popup/package.json
  • packages/suite/src/reducers/wallet/formDraftReducer.ts
  • packages/suite/src/reducers/suite/windowReducer.ts
  • suite-common/firmware/package.json
  • packages/suite/src/reducers/suite/tests/deviceReducer.test.ts
  • packages/suite/src/reducers/wallet/cardanoStakingReducer.ts
  • packages/suite/src/actions/suite/tests/storageActions.test.ts
  • packages/suite/src/middlewares/suite/suiteMiddleware.ts
  • packages/suite/src/reducers/wallet/graphReducer.ts
  • packages/suite/package.json
  • suite-common/graph/package.json
  • suite-common/analytics/package.json
  • packages/suite/src/reducers/backup/backupReducer.ts
  • suite-common/connect-init/package.json
  • packages/connect-explorer/package.json
  • packages/connect-explorer/src/store/index.ts
  • packages/suite-web/package.json
🧰 Additional context used
🪛 Biome (1.9.4)
packages/suite/src/support/tests/configureStore.tsx

[error] 13-13: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 20-20: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

packages/suite/global.d.ts

[error] 60-61: This empty export is useless because there's another export or import.

This import makes useless the empty export.

Safe fix: Remove this useless empty export.

(lint/complexity/noUselessEmptyExport)


[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: EAS Update
  • GitHub Check: build-web
  • GitHub Check: transport-e2e-test
  • GitHub Check: test
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (8)
packages/suite/src/support/tests/configureStore.tsx (2)

8-15: Custom middleware type definitions need improvement

The custom interfaces for MiddlewareAPI and Middleware have issues with the type definitions. Using any and {} as types should be avoided as they compromise type safety, which is especially important during a Redux upgrade.

Apply this diff to improve type safety:

-interface MiddlewareAPI<D extends Dispatch = Dispatch<AnyAction>, S = any> {
+interface MiddlewareAPI<D extends Dispatch = Dispatch<AnyAction>, S = unknown> {
    dispatch: D;
    getState(): S;
}

-interface Middleware<_DispatchExt = {}, S = any, D extends Dispatch = Dispatch<any>> {
+interface Middleware<_DispatchExt = Record<string, unknown>, S = unknown, D extends Dispatch = Dispatch<unknown>> {
    (api: MiddlewareAPI<D, S>): (next: Dispatch<AnyAction>) => (action: unknown) => unknown;
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 13-13: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


23-23: LGTM! Redux-thunk API usage updated correctly

The update from thunk.withExtraArgument(extraDependencies) to withExtraArgument(extraDependencies) correctly reflects the API changes in redux-thunk v3.x.

packages/suite/global.d.ts (1)

18-29: LGTM! Backward compatibility maintained for bindActionCreators

The inclusion of the older redux-thunk bindActionCreators function is a good approach to maintain backward compatibility while transitioning to newer Redux versions. Comments clearly explain why this is necessary.

packages/suite/src/reducers/store.ts (5)

56-83: LGTM! Improved middleware organization

The refactoring of middleware setup to use a getCustomMiddleware function improves modularity and testability. The conditional logger creation based on build type is also well implemented.


88-88: LGTM! Updated to modern terminology

Great job updating from the deprecated actionsBlacklist to the new actionsDenylist property, following modern terminology standards.


99-101: LGTM! Improved type safety with explicit type definitions

Adding explicit type definitions for RootReducerShape, PreloadedState, and InferredAction significantly improves type safety in the Redux store configuration.


115-119: LGTM! Explicit typing of statePatch

Good improvement by explicitly typing statePatch as Partial<AppState> to ensure type safety when merging state objects.


122-130: LGTM! Store configuration updated for Redux Toolkit 2.x

The reducer type casting and middleware setup changes align perfectly with Redux Toolkit 2.x API requirements. The use of a function to concatenate custom middleware is the recommended approach.

@Lemonexe Lemonexe force-pushed the chore/upgrade-redux branch from 274c570 to 3e0ed24 Compare March 7, 2025 13:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/suite/src/support/tests/configureStore.tsx (1)

8-15: 🛠️ Refactor suggestion

Improve type safety in middleware type definitions.

The custom interfaces for MiddlewareAPI and Middleware have issues with the type definitions:

  1. Using any in these interfaces reduces type safety, which is counter to the PR's objective of improving TypeScript types with the Redux upgrade
  2. Using {} as a type is flagged by static analysis as it means "any non-nullable value" rather than "empty object" as often assumed

Apply this change to improve type safety:

-interface MiddlewareAPI<D extends Dispatch = Dispatch<AnyAction>, S = any> {
+interface MiddlewareAPI<D extends Dispatch = Dispatch<AnyAction>, S = unknown> {
    dispatch: D;
    getState(): S;
}

-interface Middleware<_DispatchExt = {}, S = any, D extends Dispatch = Dispatch<any>> {
+interface Middleware<_DispatchExt = Record<string, unknown>, S = unknown, D extends Dispatch = Dispatch<unknown>> {
    (api: MiddlewareAPI<D, S>): (next: Dispatch<AnyAction>) => (action: unknown) => unknown;
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 13-13: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

🧹 Nitpick comments (9)
suite-common/suite-utils/tsconfig.json (2)

11-12: New Reference Added: Verify Relative Paths
The new reference to ../../packages/utils has been added to the references array. Please confirm that the relative path is correct relative to the location of this tsconfig file and that the referenced package is intended to be included in this composite project configuration, especially given the broader dependency updates in the project.


4-13: Optional: Consider Consistent Ordering of References
Although the order of the references might be intentional, aligning them in a clear, consistent order (for example, alphabetically) could improve readability and maintainability across similar configuration files.

packages/suite/src/support/tests/configureStore.tsx (1)

20-22: Improve type safety in configureStore function signature.

The function signature uses {} as a type for DispatchExts, which is flagged by static analysis.

Apply this change to improve type safety:

-export const configureStore = <S, DispatchExts = {}>(
+export const configureStore = <S, DispatchExts = Record<string, unknown>>(
    middlewares?: Middleware[],
): MockStoreCreator<S, DispatchExts> =>
🧰 Tools
🪛 Biome (1.9.4)

[error] 20-20: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

packages/suite/global.d.ts (4)

16-17: Consider tracking this technical debt item.

Since this is meant to be temporary, consider creating a ticket or adding a TODO with a JIRA reference to track the removal of this compatibility layer once the codebase no longer needs it.


53-53: Replace {} with a more specific type.

The empty object type {} is generally discouraged as it means "any non-nullable value" rather than "empty object". Consider using a more explicit type like Record<string, never> for an empty object or unknown if truly any non-nullable value is acceptable.

-    export interface Middleware<
-        _DispatchExt = {},
+    export interface Middleware<
+        _DispatchExt = Record<string, never>,
🧰 Tools
🪛 Biome (1.9.4)

[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


57-57: Consider using more specific types than any.

The any type in the middleware function signature bypasses TypeScript's type checking. While this might be necessary for compatibility now, it's worth noting as an area to improve in the future when possible.


61-61: Remove unnecessary empty export.

This empty export is not needed since the file already has imports, which makes it a module rather than an ambient declaration.

-export {};
🧰 Tools
🪛 Biome (1.9.4)

[error] 60-61: This empty export is useless because there's another export or import.

This import makes useless the empty export.

Safe fix: Remove this useless empty export.

(lint/complexity/noUselessEmptyExport)

suite-common/test-utils/src/configureMockStore.ts (1)

26-37: Updated type parameters for configureMockStore function

The changes to the type parameters reflect the updates in Redux's type system, but there's an issue with the use of {} as a type.

Consider replacing the empty object type {} with a more specific type definition or Record<string, unknown> to address the static analysis warning:

-    reducer?: Reducer<S, A, {}> | ReducersMapObject<S, A, {}>;
+    reducer?: Reducer<S, A, Record<string, unknown>> | ReducersMapObject<S, A, Record<string, unknown>>;
🧰 Tools
🪛 Biome (1.9.4)

[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

suite-common/redux-utils/src/types.ts (1)

26-36: Consider improving type safety in AnyAsyncThunk

While the structure is sound, the widespread use of any in this type definition reduces type safety. This is likely what you were referring to in the PR description about not being completely satisfied with some uses of any.

Consider using more specific types for the action parameters and return types where possible.

type AnyAsyncThunk = {
    pending: {
-        match: (action: any) => action is any;
+        match: <PendingAction extends Action>(action: unknown) => action is PendingAction;
    };
    fulfilled: {
-        match: (action: any) => action is any;
+        match: <FulfilledAction extends Action>(action: unknown) => action is FulfilledAction;
    };
    rejected: {
-        match: (action: any) => action is any;
+        match: <RejectedAction extends Action>(action: unknown) => action is RejectedAction;
    };
};
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 274c570 and 3e0ed24.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (103)
  • packages/connect-explorer/package.json (1 hunks)
  • packages/connect-explorer/src/store/index.ts (1 hunks)
  • packages/suite-desktop-connect-popup/package.json (2 hunks)
  • packages/suite-desktop-ui/package.json (1 hunks)
  • packages/suite-web/package.json (1 hunks)
  • packages/suite/global.d.ts (1 hunks)
  • packages/suite/package.json (4 hunks)
  • packages/suite/src/actions/suite/__tests__/storageActions.test.ts (1 hunks)
  • packages/suite/src/middlewares/suite/__tests__/buttonRequestMiddleware.test.ts (2 hunks)
  • packages/suite/src/middlewares/suite/__tests__/messageSystemMiddleware.test.ts (0 hunks)
  • packages/suite/src/middlewares/suite/__tests__/redirectMiddleware.test.ts (1 hunks)
  • packages/suite/src/middlewares/suite/suiteMiddleware.ts (2 hunks)
  • packages/suite/src/reducers/backup/backupReducer.ts (1 hunks)
  • packages/suite/src/reducers/onboarding/onboardingReducer.ts (1 hunks)
  • packages/suite/src/reducers/recovery/recoveryReducer.ts (1 hunks)
  • packages/suite/src/reducers/store.ts (4 hunks)
  • packages/suite/src/reducers/suite/__tests__/deviceReducer.test.ts (7 hunks)
  • packages/suite/src/reducers/suite/desktopUpdateReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/index.ts (1 hunks)
  • packages/suite/src/reducers/suite/metadataReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/protocolReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/suiteReducer.ts (1 hunks)
  • packages/suite/src/reducers/suite/windowReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/accountSearchReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/cardanoStakingReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/coinjoinReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/formDraftReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/graphReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/receiveReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/settingsReducer.ts (1 hunks)
  • packages/suite/src/reducers/wallet/tradingReducer.ts (1 hunks)
  • packages/suite/src/support/tests/configureStore.tsx (1 hunks)
  • suite-common/analytics/package.json (1 hunks)
  • suite-common/bluetooth/package.json (1 hunks)
  • suite-common/connect-init/package.json (2 hunks)
  • suite-common/device-authenticity/package.json (1 hunks)
  • suite-common/firmware/package.json (1 hunks)
  • suite-common/graph/package.json (2 hunks)
  • suite-common/logger/package.json (1 hunks)
  • suite-common/message-system/package.json (2 hunks)
  • suite-common/redux-utils/package.json (2 hunks)
  • suite-common/redux-utils/src/createMiddleware.ts (3 hunks)
  • suite-common/redux-utils/src/hooks/useSelectorDeepComparison.ts (1 hunks)
  • suite-common/redux-utils/src/types.ts (2 hunks)
  • suite-common/suite-types/package.json (1 hunks)
  • suite-common/suite-utils/package.json (1 hunks)
  • suite-common/suite-utils/src/device.ts (2 hunks)
  • suite-common/suite-utils/tsconfig.json (1 hunks)
  • suite-common/test-utils/package.json (2 hunks)
  • suite-common/test-utils/src/configureMockStore.ts (3 hunks)
  • suite-common/toast-notifications/package.json (1 hunks)
  • suite-common/token-definitions/package.json (1 hunks)
  • suite-common/trading/package.json (2 hunks)
  • suite-common/trading/src/thunks/buy/__tests__/handleRequestThunk.test.ts (1 hunks)
  • suite-common/wallet-core/package.json (1 hunks)
  • suite-common/wallet-core/src/send/sendFormThunks.ts (6 hunks)
  • suite-common/walletconnect/package.json (1 hunks)
  • suite-native/accounts/package.json (2 hunks)
  • suite-native/app/package.json (2 hunks)
  • suite-native/assets/package.json (1 hunks)
  • suite-native/atoms/package.json (1 hunks)
  • suite-native/coin-enabling/package.json (2 hunks)
  • suite-native/connection-status/package.json (1 hunks)
  • suite-native/device-authorization/package.json (2 hunks)
  • suite-native/device-manager/package.json (2 hunks)
  • suite-native/device/package.json (2 hunks)
  • suite-native/device/src/middlewares/deviceMiddleware.ts (2 hunks)
  • suite-native/device/src/utils.ts (1 hunks)
  • suite-native/discovery/package.json (2 hunks)
  • suite-native/feature-flags/package.json (1 hunks)
  • suite-native/firmware/package.json (2 hunks)
  • suite-native/firmware/src/nativeFirmwareSlice.ts (1 hunks)
  • suite-native/formatters/package.json (1 hunks)
  • suite-native/graph/package.json (2 hunks)
  • suite-native/icons/package.json (1 hunks)
  • suite-native/message-system/package.json (2 hunks)
  • suite-native/module-accounts-import/package.json (2 hunks)
  • suite-native/module-accounts-management/package.json (2 hunks)
  • suite-native/module-add-accounts/package.json (2 hunks)
  • suite-native/module-authenticity-checks/package.json (1 hunks)
  • suite-native/module-authorize-device/package.json (2 hunks)
  • suite-native/module-connect-popup/package.json (1 hunks)
  • suite-native/module-dev-utils/package.json (1 hunks)
  • suite-native/module-device-settings/package.json (2 hunks)
  • suite-native/module-home/package.json (2 hunks)
  • suite-native/module-onboarding/package.json (2 hunks)
  • suite-native/module-send/package.json (2 hunks)
  • suite-native/module-settings/package.json (2 hunks)
  • suite-native/module-staking-management/package.json (2 hunks)
  • suite-native/module-trading/package.json (1 hunks)
  • suite-native/module-trading/src/hooks/__tests__/useReceiveAccountsListData.test.tsx (3 hunks)
  • suite-native/module-trading/tsconfig.json (1 hunks)
  • suite-native/navigation/package.json (1 hunks)
  • suite-native/notifications/package.json (1 hunks)
  • suite-native/receive/package.json (2 hunks)
  • suite-native/settings/package.json (1 hunks)
  • suite-native/state/package.json (2 hunks)
  • suite-native/state/src/reducers.ts (1 hunks)
  • suite-native/state/src/store.ts (3 hunks)
  • suite-native/storage/package.json (1 hunks)
  • suite-native/test-utils/package.json (2 hunks)
  • suite-native/test-utils/src/StoreProviderForTests.tsx (1 hunks)
  • suite-native/transactions/package.json (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/suite/src/middlewares/suite/tests/messageSystemMiddleware.test.ts
🚧 Files skipped from review as they are similar to previous changes (95)
  • suite-native/module-trading/tsconfig.json
  • suite-native/navigation/package.json
  • suite-common/walletconnect/package.json
  • suite-native/assets/package.json
  • suite-native/module-authenticity-checks/package.json
  • suite-native/icons/package.json
  • packages/suite/src/reducers/suite/suiteReducer.ts
  • suite-native/atoms/package.json
  • packages/suite/src/reducers/suite/protocolReducer.ts
  • packages/suite/src/reducers/wallet/formDraftReducer.ts
  • suite-native/module-add-accounts/package.json
  • suite-native/storage/package.json
  • packages/suite/src/reducers/backup/backupReducer.ts
  • suite-native/formatters/package.json
  • suite-native/feature-flags/package.json
  • suite-common/firmware/package.json
  • packages/suite/src/reducers/wallet/tradingReducer.ts
  • suite-native/test-utils/src/StoreProviderForTests.tsx
  • packages/suite-web/package.json
  • packages/suite/src/reducers/suite/windowReducer.ts
  • packages/suite/src/middlewares/suite/tests/buttonRequestMiddleware.test.ts
  • suite-native/accounts/package.json
  • packages/suite-desktop-ui/package.json
  • suite-native/module-accounts-import/package.json
  • packages/suite/src/reducers/wallet/settingsReducer.ts
  • packages/suite/src/reducers/wallet/coinjoinReducer.ts
  • suite-common/message-system/package.json
  • suite-native/module-trading/package.json
  • suite-common/analytics/package.json
  • suite-native/device-manager/package.json
  • packages/suite/src/reducers/wallet/receiveReducer.ts
  • suite-native/module-staking-management/package.json
  • suite-native/app/package.json
  • suite-native/device/src/utils.ts
  • suite-common/redux-utils/src/createMiddleware.ts
  • suite-native/coin-enabling/package.json
  • suite-common/test-utils/package.json
  • suite-common/bluetooth/package.json
  • suite-common/trading/package.json
  • suite-native/device-authorization/package.json
  • suite-native/module-onboarding/package.json
  • suite-native/module-dev-utils/package.json
  • packages/suite/src/actions/suite/tests/storageActions.test.ts
  • suite-native/module-device-settings/package.json
  • suite-common/toast-notifications/package.json
  • suite-common/redux-utils/src/hooks/useSelectorDeepComparison.ts
  • packages/suite/src/reducers/suite/metadataReducer.ts
  • suite-native/firmware/package.json
  • suite-native/module-settings/package.json
  • suite-common/suite-utils/src/device.ts
  • packages/suite-desktop-connect-popup/package.json
  • suite-common/token-definitions/package.json
  • packages/suite/src/reducers/suite/tests/deviceReducer.test.ts
  • suite-native/device/package.json
  • suite-native/state/src/reducers.ts
  • suite-common/device-authenticity/package.json
  • suite-native/settings/package.json
  • suite-native/module-authorize-device/package.json
  • suite-native/receive/package.json
  • packages/suite/src/reducers/suite/index.ts
  • suite-native/notifications/package.json
  • packages/suite/src/reducers/wallet/accountSearchReducer.ts
  • suite-native/module-connect-popup/package.json
  • suite-common/trading/src/thunks/buy/tests/handleRequestThunk.test.ts
  • packages/suite/src/reducers/wallet/graphReducer.ts
  • suite-common/graph/package.json
  • suite-native/test-utils/package.json
  • suite-native/state/package.json
  • suite-native/discovery/package.json
  • packages/suite/src/reducers/suite/desktopUpdateReducer.ts
  • suite-common/connect-init/package.json
  • suite-common/suite-types/package.json
  • suite-native/state/src/store.ts
  • packages/suite/src/reducers/recovery/recoveryReducer.ts
  • packages/connect-explorer/src/store/index.ts
  • suite-native/module-trading/src/hooks/tests/useReceiveAccountsListData.test.tsx
  • suite-common/wallet-core/package.json
  • packages/suite/src/reducers/wallet/cardanoStakingReducer.ts
  • suite-common/redux-utils/package.json
  • suite-native/message-system/package.json
  • suite-native/module-accounts-management/package.json
  • suite-native/connection-status/package.json
  • suite-native/module-send/package.json
  • packages/suite/src/reducers/onboarding/onboardingReducer.ts
  • suite-common/logger/package.json
  • suite-native/transactions/package.json
  • packages/suite/src/middlewares/suite/suiteMiddleware.ts
  • packages/suite/package.json
  • suite-native/device/src/middlewares/deviceMiddleware.ts
  • suite-native/firmware/src/nativeFirmwareSlice.ts
  • packages/connect-explorer/package.json
  • suite-native/module-home/package.json
  • suite-common/wallet-core/src/send/sendFormThunks.ts
  • suite-native/graph/package.json
  • packages/suite/src/middlewares/suite/tests/redirectMiddleware.test.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/suite/src/support/tests/configureStore.tsx

[error] 13-13: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 20-20: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

packages/suite/global.d.ts

[error] 60-61: This empty export is useless because there's another export or import.

This import makes useless the empty export.

Safe fix: Remove this useless empty export.

(lint/complexity/noUselessEmptyExport)


[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

suite-common/test-utils/src/configureMockStore.ts

[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 35-35: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: EAS Update
  • GitHub Check: transport-e2e-test
  • GitHub Check: prepare_android_test_app
  • GitHub Check: build-web
  • GitHub Check: test
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (21)
suite-common/suite-utils/package.json (1)

22-22: New Dependency Addition: @trezor/utils
The addition of "@trezor/utils": "workspace:*" appears correct and aligns with the broader dependency updates across the project. Please ensure that any usage of this package within the suite utils is well-documented and that any potential version conflicts in your workspace configuration are addressed.

packages/suite/src/support/tests/configureStore.tsx (2)

23-23: Implementation correctly updated for Redux Thunk v3.

The middleware configuration has been correctly updated to use the named export withExtraArgument from redux-thunk v3 instead of the previous module approach.


1-4: Import statements correctly updated for Redux toolkit v2.

The import statements have been properly updated to match the new module structure in Redux Toolkit v2 and Redux Thunk v3.

packages/suite/global.d.ts (1)

12-59: Good handling of Redux type compatibility during upgrade.

The module declaration provides necessary type definitions to maintain compatibility between older code patterns and the upgraded Redux libraries. The comments clearly explain the rationale behind each addition.

🧰 Tools
🪛 Biome (1.9.4)

[error] 53-53: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

packages/suite/src/reducers/store.ts (7)

3-10: Improved Redux imports for better type safety

These added import types from Redux Toolkit will help ensure proper typing throughout the Redux store configuration, particularly important when upgrading to newer Redux versions.


54-55: Updated action exclusion list with new action type

The renamed loggerExcludedActions array and updated reference to accountsActions.updateAccount.type aligns with the updated Redux action naming conventions.


56-83: Good refactoring of middleware configuration

Extracting middleware creation into a dedicated function getCustomMiddleware improves code organization and maintainability. The conditional logger inclusion based on build type is well-structured, and the proper typing of the returned middleware array enhances type safety.


85-90: Updated DevTools configuration terminology

Replacing actionsBlacklist with actionsDenylist follows the modern terminology used in Redux DevTools, aligning with industry standards for inclusive language.


99-101: Good type definitions for improved type safety

These new type definitions provide clear typing for the Redux store components, which will improve type checking and prevent potential type-related issues.


115-119: Improved type safety for state merging

The explicit typing of statePatch as Partial<AppState> addresses the previous issue mentioned in the code review comments, providing better type safety without resorting to unsafe type assertions.


122-130: Enhanced store configuration with proper typing

The updated configureStore call with proper reducer typing and middleware function configuration follows Redux Toolkit best practices, particularly for the newer versions. The type assertion at the end ensures immutability of the configuration.

suite-common/test-utils/src/configureMockStore.ts (7)

2-7: Updated Redux imports for compatibility with upgraded Redux

Renaming Middleware to RTKMiddleware and adding configureStore improves clarity about which Redux implementation is being used, which is important during a library upgrade.


10-10: Updated import to use named imports

Switching to named imports improves code clarity and better matches the exports from @suite-common/redux-utils.


19-20: Updated type parameters for initPreloadedState

The additional type parameter in the Reducer type signature and the change to any for partialState accommodate changes in Redux's type system in the newer version.


42-47: Improved null checking for meta property

The enhanced conditional check for the meta property ensures that it's not only present but also an object and not null before attempting to access its properties, preventing potential runtime errors.


55-59: Updated approach to handling meta properties

Instead of deleting meta properties, they're now set to undefined, which better preserves the object structure while still removing meaningful values that could impact testing.


78-78: Added proper type casting for middleware

This explicit type casting helps ensure type compatibility with the updated RTKMiddleware type from Redux Toolkit.


86-86: Updated return type with explicit casting

Adding explicit type casting to AnyAction[] improves type safety and clarity about what's being returned.

suite-common/redux-utils/src/types.ts (3)

17-24: Well-structured type utilities for action matching

These type definitions create a robust system for type checking and matching actions. The progression from TypeGuard to HasMatchFunction to Matcher and finally ActionFromMatcher creates a flexible yet type-safe way to work with actions.

The use of generics and conditional types is particularly elegant, ensuring proper type inference when these utilities are used.


37-40: Good use of type composition

The ActionsFromAsyncThunk type elegantly combines all possible action types from an async thunk into a union type. This makes it easier to handle all possible actions that can be dispatched by an async thunk in a type-safe way.

This is a good pattern that will improve type safety throughout the application when dealing with async operations.


1-5:

❓ Verification inconclusive

Thoughtful approach to Redux upgrade compatibility

The replacement of the imported AnyAction with Action from Redux toolkit, and creating your own AnyAction interface that extends it is a good approach for handling the breaking changes in the Redux upgrade. This maintains backward compatibility while adapting to the new API.

However, the [extraProps: string]: any index signature introduces some type unsafety. While sometimes necessary during migrations, consider adding a TODO comment to revisit this in the future when legacy code is fully updated.


🏁 Script executed:

#!/bin/bash
# Check how widely the AnyAction type is used in the codebase
echo "Checking usage of AnyAction type throughout the codebase..."
rg -l "AnyAction" --type ts | grep -v "node_modules" | sort

Length of output: 1297


Redux Upgrade Compatibility – Confirm TODO for Index Signature

Great work on extending Redux Toolkit’s Action to create a custom AnyAction interface. This solution smartly handles the Redux breaking changes while keeping backward compatibility. However, the index signature ([extraProps: string]: any) introduces some type unsafety, which is notable given its widespread usage across the codebase (e.g., in files like suite-common/analytics/src/analyticsReducer.ts, suite-common/bluetooth/redux.d.ts, etc.). To help future-proof our code and ease eventual refactoring, please add a TODO comment in suite-common/redux-utils/src/types.ts near the index signature to flag this for review once the legacy updates are complete.

/**
* This is copied from older version of the redux-thunk package
* https://github.com/reduxjs/redux-thunk/blob/698241dec398639018d5f21c529b0889b78d36f8/extend-redux.d.ts
* Because suite still use that odl bindActionCreators function we need to keep it, once we get rid of that we can remove this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should not be that hard to refactor it, it is on just few places

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, noticed the comment only now 😬
If you know what should be done to get rid of the declaration, could you do a followup PR?

@Lemonexe Lemonexe merged commit 39c71a1 into develop Mar 7, 2025
73 checks passed
@Lemonexe Lemonexe deleted the chore/upgrade-redux branch March 7, 2025 13:42
Copy link

sentry-io bot commented Mar 7, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Sentry.withScope$argument_0 reportCheckFail View Issue
  • ‼️ Sentry.withScope$argument_0 reportCheckFail View Issue
  • ‼️ reportCheckFail: Firmware revision check failed! {"model":"T2B1","revision":"dd4671a5104952ef505d28d1f9e94d1484b4607a","version":"2.8.0","vendor":"Trezor","errorType":"other-error"} Sentry.withScope$argument_0(/home/jzbytovsky/Re... View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-project This label is used to specify that PR doesn't need to be added to a project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants