Skip to content

Commit

Permalink
fix(ui-ux): handle empty wallet address
Browse files Browse the repository at this point in the history
  • Loading branch information
lykalabrada committed Oct 25, 2023
1 parent 27491cf commit 3e0a235
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import * as SplashScreen from "expo-splash-screen";
import { useLogger } from "@shared-contexts/NativeLoggingProvider";
import { bottomTabDefaultRoutes } from "@screens/AppNavigator/constants/DefaultRoutes";
import { DomainType, useDomainContext } from "@contexts/DomainContext";
// import { AddressSelectionButtonV2 } from "./components/AddressSelectionButtonV2";
import { AddressSelectionButtonV2 } from "./components/AddressSelectionButtonV2";
import { ActionButtons } from "./components/ActionButtons";
import {
BottomSheetAssetSortList,
Expand Down Expand Up @@ -637,8 +637,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element {
dark={tailwind("bg-mono-dark-v2-00")}
style={tailwind("px-5 flex flex-row items-center")}
>
{/* TODO(lyka): Add back */}
{/* <AddressSelectionButtonV2 onPress={() => expandModal(false)} /> */}
<AddressSelectionButtonV2 onPress={() => expandModal(false)} />
<ThemedTouchableOpacityV2
testID="toggle_balance"
style={tailwind("ml-2")}
Expand Down
27 changes: 17 additions & 10 deletions shared/store/userPreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,23 @@ export const selectLocalWalletAddressArray = createSelector(
export const selectAllLabeledWalletAddress = createSelector(
(state: UserPreferences) => state.addresses,
(walletAddress): LabeledAddress => {
return (Object.values(walletAddress) as LocalAddress[]).reduce(
(allAddress, each) => {
return {
...allAddress,
[each.address]: each,
[each.evmAddress]: each,
};
},
{},
);
try {
if (walletAddress === undefined) {
return {} as LabeledAddress;
}
return (Object.values(walletAddress) as LocalAddress[]).reduce(
(allAddress, each) => {
return {
...allAddress,
[each.address]: each,
[each.evmAddress]: each,
};
},
{},
);
} catch (e) {
return {} as LabeledAddress;
}
},
);

Expand Down

0 comments on commit 3e0a235

Please sign in to comment.