Skip to content

Commit

Permalink
fix: hide multisig after deletion (#2618)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokolova-an authored Nov 11, 2024
1 parent cfecc26 commit 40033fa
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ sample({

sample({
clock: updateWcAccountsFx.done,
source: walletModel.$wallets,
source: walletModel.$allWallets,
filter: (_, { result: accounts }) => Boolean(accounts?.length),
fn: (wallets, { params }) => {
return wallets.map<Wallet>((wallet) => {
Expand Down Expand Up @@ -392,7 +392,7 @@ sample({

sample({
clock: sessionTopicUpdatedFx.doneData,
source: walletModel.$wallets,
source: walletModel.$allWallets,
filter: (_, accounts) => Boolean(accounts?.length),
fn: (wallets, accounts) => {
const walletId = accounts![0].walletId;
Expand Down Expand Up @@ -429,7 +429,7 @@ sample({
sample({
clock: [$client, walletModel.events.walletCreatedDone],
source: {
wallets: walletModel.$wallets,
wallets: walletModel.$allWallets,
client: $client,
},
filter: ({ client }) => Boolean(client),
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/features/proxies/model/proxies-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ sample({

sample({
clock: createProxiedWalletsFx.doneData,
source: walletModel.$wallets,
source: walletModel.$allWallets,
filter: (_, data) => Boolean(data && data.wallets.length && data.accounts.length),
fn: (wallets, data) => {
const accountsMap = dictionary(data.accounts, 'walletId');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ sample({

sample({
clock: renameWalletFx.doneData,
source: walletModel.$wallets,
source: walletModel.$allWallets,
fn: (wallets, updatedWallet) => {
const updatedWalletIndex = wallets.findIndex((w) => w.id === updatedWallet.id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ sample({

sample({
clock: walletSelectedFx.doneData,
source: walletModel.$wallets,
source: walletModel.$allWallets,
filter: (_, nextId) => Boolean(nextId),
fn: (wallets, nextId) => {
return wallets.map((wallet) => ({ ...wallet, isActive: wallet.id === nextId }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ sample({ clock: vaultCreated, target: createVaultFx });
// TODO: should use factory
sample({
clock: createVaultFx.doneData,
source: walletModel.$wallets,
source: walletModel.$allWallets,
filter: (_, data) => Boolean(data),
fn: (wallets, data) => wallets.concat(data!),
target: walletModel.$allWallets,
Expand Down
7 changes: 3 additions & 4 deletions src/renderer/processes/multisigs/model/multisigs-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,17 @@ sample({
clock: [multisigsDiscoveryTriggered, once(networkModel.$connections)],
source: {
chains: $multisigChains,
wallets: walletModel.$wallets,
hiddenWallets: walletModel.$hiddenWallets,
wallets: walletModel.$allWallets,
connections: networkModel.$connections,
},
fn: ({ chains, wallets, hiddenWallets, connections }) => {
fn: ({ chains, wallets, connections }) => {
const filteredChains = chains.filter(
(chain) => connections[chain.chainId] && !networkUtils.isDisabledConnection(connections[chain.chainId]),
);

return {
chains: filteredChains,
wallets: wallets.concat(hiddenWallets),
wallets: wallets,
};
},
target: getMultisigsFx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,7 @@ export const SelectSignatoriesThreshold = () => {
</Alert>
</div>
<div className="flex items-end gap-x-4">
<Alert
active={Boolean(multisigAlreadyExists)}
title={t('createMultisigAccount.multisigExistTitle')}
variant="error"
>
<Alert active={multisigAlreadyExists} title={t('createMultisigAccount.multisigExistTitle')} variant="error">
<Alert.Item withDot={false}>{t('createMultisigAccount.multisigExistText')}</Alert.Item>
</Alert>

Expand All @@ -156,7 +152,11 @@ export const SelectSignatoriesThreshold = () => {
</Alert.Item>
</Alert>

<Alert active={Boolean(hiddenMultisig)} title={t('createMultisigAccount.multisigExistTitle')} variant="info">
<Alert
active={!multisigAlreadyExists && Boolean(hiddenMultisig)}
title={t('createMultisigAccount.multisigExistTitle')}
variant="info"
>
<Alert.Item withDot={false}>{t('createMultisigAccount.multisigHiddenExistText')}</Alert.Item>
<Alert.Item withDot={false}>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ sample({

sample({
clock: removeKeysFx.doneData,
source: walletModel.$wallets,
source: walletModel.$allWallets,
filter: (_, ids) => Boolean(ids),
fn: (wallets, ids) => {
const removeMap = ids!.reduce<Record<ID, boolean>>((acc, id) => ({ ...acc, [id]: true }), {});
Expand All @@ -108,7 +108,7 @@ sample({ clock: accountsCreated, target: createAccountsFx });

sample({
clock: createAccountsFx.done,
source: walletModel.$wallets,
source: walletModel.$allWallets,
filter: (_, { result }) => Boolean(result),
fn: (wallets, { params, result }) => {
return wallets.map((wallet) => {
Expand Down

0 comments on commit 40033fa

Please sign in to comment.