Skip to content
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

fix: allow deleting last wallet #122

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Conversation

im-adithya
Copy link
Member

Fixes #118

Also fixes Reset. Both will now redirect the user to the /onboarding screen.

@reneaaron reneaaron added this to the 1.5 milestone Sep 16, 2024
Copy link
Contributor

@reneaaron reneaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@reneaaron reneaaron merged commit 4f05700 into master Sep 17, 2024
1 check passed
@@ -99,7 +99,15 @@ export const useAppStore = create<AppState>()((set, get) => {
const removeCurrentWallet = () => {
const wallets = [...get().wallets];
if (wallets.length <= 1) {
// cannot delete last wallet
// set to initial wallet status
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this check is needed or if we can actually just delete the whole if?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we need this check? We only do the below if it is the last wallet right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the bottom is still does:

    get().setSelectedWalletId(0);
    set({
      wallets: wallets.filter((_, i) => i !== selectedWalletId),
    });

But I think there is actually a bug in the for loop - it will always not work if you try delete the wallet at the last index

@im-adithya im-adithya deleted the task-delete-last-wallet branch November 18, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't delete last wallet
3 participants