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 removing counterfactual safes from safe list #4643

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Conversation

jmealy
Copy link
Contributor

@jmealy jmealy commented Dec 11, 2024

What it solves

Resolves #4611

How this PR fixes it

  • Removes the counterfactual safe from the undeployedSafes store as well as from the addedSafes store.
  • If the safe being removed is the currently opened safe, redirect to the accounts page.

How to test it

  • Create a counterfactual safe
  • it should be possible to remove the safe from the context menu of the CF safe in the sidebar.
  • If the CF safe being removed is currently opened, redirect to the accounts page.

Screenshots

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Dec 11, 2024

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code review by ChatGPT

if (safeAddress === address && safeChainId === chainId) {
await router.push(AppRoutes.welcome.accounts)
}
dispatch(removeUndeployedSafe({ chainId, address }))
dispatch(removeSafe({ chainId, address }))
dispatch(removeAddressBookEntry({ chainId, address }))
handleClose()

Choose a reason for hiding this comment

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

  1. Consolidate useSafeAddress and useChainId within a custom hook or context if they are frequently used together to avoid code repetition.

  2. Add error-handling logic to handleConfirm for the router.push call to manage possible navigation failures.

Copy link

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1020.66 KB (🟡 +40 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Copy link

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
73.68% (-0.02% 🔻)
14378/19513
🔴 Branches
51.05% (-0.04% 🔻)
3418/6696
🔴 Functions 56.44% 2029/3595
🟡 Lines
75.25% (-0.02% 🔻)
13048/17339
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / index.tsx
72.73% (-4.55% 🔻)
75% (-25% 🔻)
60%
71.43% (-4.76% 🔻)
🔴
... / index.tsx
54.84% (-7.66% 🔻)
0% 0%
56.67% (-8.55% 🔻)

Test suite run success

1675 tests passing in 228 suites.

Report generated by 🧪jest coverage report action from 80d1563

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@usame-algan usame-algan left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

I tested the following cases:

  1. Remove pinned, undeployed safe while open -> Redirects to the accounts page
  2. Remove unpinned, undeployed safe while open -> Redirects to the accounts page
  3. Remove pinned, undeployed safe on the accounts page -> Removes it and stays there
  4. Remove unpinned, undeployed safe on the accounts page -> Removes it and stays there

@jmealy jmealy merged commit d094768 into dev Dec 13, 2024
16 checks passed
@jmealy jmealy deleted the remove-CF-safes branch December 13, 2024 15:33
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidebar: Remove CF doesn't work from the sidebar
3 participants