Skip to content

Commit

Permalink
fix(suite-native): show correct device label for each device
Browse files Browse the repository at this point in the history
- #14483 broke device label in case of multiple devices. Device label of selected device was reused for all of them.
  • Loading branch information
matejkriz committed Oct 15, 2024
1 parent edffb35 commit c56f065
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DeviceRootState,
PORTFOLIO_TRACKER_DEVICE_ID,
selectHasOnlyEmptyPortfolioTracker,
selectDeviceLabelOrName,
selectDeviceLabelOrNameById,
} from '@suite-common/wallet-core';
import { prepareNativeStyle, useNativeStyles } from '@trezor/styles';
import { TypographyStyle } from '@trezor/theme';
Expand Down Expand Up @@ -67,7 +67,7 @@ export const DeviceItemContent = React.memo(
return {
id: d.id,
name: d.name,
label: selectDeviceLabelOrName(state),
label: selectDeviceLabelOrNameById(state, d.id),
walletNumber: d.walletNumber,
useEmptyPassphrase: d.useEmptyPassphrase,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { Button, HStack, Loader, Text } from '@suite-native/atoms';
import { Translation } from '@suite-native/intl';
import {
ConnectDeviceSettings,
DeviceRootState,
deviceActions,
selectDeviceLabelOrName,
selectDeviceLabelOrNameById,
selectHasDeviceDiscovery,
} from '@suite-common/wallet-core';
import { analytics, EventType } from '@suite-native/analytics';
Expand Down Expand Up @@ -33,7 +34,9 @@ export const WalletRow = ({ device }: WalletRowProps) => {
const { showToast } = useToast();
const { applyStyle } = useNativeStyles();
const hasDiscovery = useSelector(selectHasDeviceDiscovery);
const deviceLabel = useSelector(selectDeviceLabelOrName);
const deviceLabel = useSelector((state: DeviceRootState) =>
selectDeviceLabelOrNameById(state, device?.id),
);

const walletNameLabel = device.useEmptyPassphrase ? (
<Translation id="moduleSettings.viewOnly.wallet.standard" />
Expand Down

0 comments on commit c56f065

Please sign in to comment.