Skip to content

ZEUS-2616: Switch wallet via 'Set wallet config as active' leads to buggy state #2686

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

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading