Skip to content

Commit

Permalink
Merge pull request #2686 from kaloudis/zeus-2616
Browse files Browse the repository at this point in the history
ZEUS-2616: Switch wallet via 'Set wallet config as active' leads to buggy state
  • Loading branch information
kaloudis authored Jan 2, 2025
2 parents 912b6cb + 02d5173 commit e8e5bce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
10 changes: 7 additions & 3 deletions views/Settings/WalletConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -621,19 +621,23 @@ export default class WalletConfiguration extends React.Component<
: undefined;
}

setWalletConfigurationAsActive = () => {
setWalletConfigurationAsActive = async () => {
const { SettingsStore, navigation } = this.props;
const { updateSettings } = SettingsStore;
const { updateSettings, setConnectingStatus, setInitialStart } =
SettingsStore;
const { index } = this.state;

updateSettings({
await updateSettings({
selectedNode: index
});

this.setState({
active: true
});

setConnectingStatus(true);
setInitialStart(false);

navigation.popTo('Wallet', { refresh: true });
};

Expand Down
19 changes: 2 additions & 17 deletions views/Settings/Wallets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ import NodeIdenticon, { NodeTitle } from '../../components/NodeIdenticon';
import Screen from '../../components/Screen';
import LoadingIndicator from '../../components/LoadingIndicator';

import BalanceStore from '../../stores/BalanceStore';
import NodeInfoStore from '../../stores/NodeInfoStore';
import SettingsStore, {
INTERFACE_KEYS,
Node
} from '../../stores/SettingsStore';
import ChannelsStore from '../../stores/ChannelsStore';

import { getPhoto } from '../../utils/PhotoUtils';
import { localeString } from '../../utils/LocaleUtils';
Expand All @@ -49,9 +46,6 @@ interface NodesProps {
edit?: boolean;
loading?: boolean;
selectedNode?: number;
BalanceStore: BalanceStore;
NodeInfoStore: NodeInfoStore;
ChannelsStore: ChannelsStore;
SettingsStore: SettingsStore;
}

Expand All @@ -63,7 +57,7 @@ interface NodesState {

const TypedDragList = DragList as unknown as React.ComponentType<Props<Node>>;

@inject('BalanceStore', 'NodeInfoStore', 'ChannelsStore', 'SettingsStore')
@inject('SettingsStore')
@observer
export default class Nodes extends React.Component<NodesProps, NodesState> {
isInitialFocus = true;
Expand Down Expand Up @@ -118,13 +112,7 @@ export default class Nodes extends React.Component<NodesProps, NodesState> {
);

render() {
const {
navigation,
BalanceStore,
NodeInfoStore,
ChannelsStore,
SettingsStore
} = this.props;
const { navigation, SettingsStore } = this.props;
const { loading, nodes, selectedNode } = this.state;
const {
updateSettings,
Expand Down Expand Up @@ -263,9 +251,6 @@ export default class Nodes extends React.Component<NodesProps, NodesState> {
nodes,
selectedNode: index
}).then(() => {
BalanceStore.reset();
NodeInfoStore.reset();
ChannelsStore.reset();
setConnectingStatus(true);
setInitialStart(false);
navigation.popTo('Wallet', {
Expand Down

0 comments on commit e8e5bce

Please sign in to comment.