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: Refetch owned safes after deployment #4673

Merged
merged 1 commit into from
Dec 16, 2024
Merged

Conversation

usame-algan
Copy link
Member

What it solves

Fixes issue found in the release

How this PR fixes it

  • Calls refetch on the RTK query for all owned safes when receiving a SafeCreationEvent.INDEXED

How to test it

  1. Create a safe with the pay later option
  2. Activate the Safe
  3. Open the Sidebar
  4. Observe there is no "read-only" chip next to the safe item

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 16, 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

@@ -59,7 +69,7 @@ const usePendingSafeNotifications = (): void => {
return () => {
unsubFns.forEach((unsub) => unsub())
}
}, [dispatch, safeAddress, chain])
}, [dispatch, safeAddress, chain, refetch])
}

export default usePendingSafeNotifications

Choose a reason for hiding this comment

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

  1. Unnecessarily destructuring address with a default value of an empty string in useWallet(). Ensure useWallet() provides a consistent object structure.

  2. Dependencies for useEffect revised correctly, but consider removing the inline if condition for clarity: const skipTokenCondition = address === ''.

  3. Consider moving the logic from useEffect outside to maintain its primary role of side-effect management and prevent excess logic within the hook.

Comment on lines +32 to +33
const { address = '' } = useWallet() || {}
const { refetch } = useGetAllOwnedSafesQuery(address === '' ? skipToken : { walletAddress: address })
Copy link
Member Author

Choose a reason for hiding this comment

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

Its probably cleaner to create a new listener middleware for this. Wdyt @katspaugh @compojoom

Copy link
Member Author

Choose a reason for hiding this comment

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

Although it does require access to the connected wallet which I am not sure is possible inside a middleware. We would have to move the connected wallet state into Redux as well.

Copy link

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

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

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 1016.46 KB (-2 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.84% 14383/19478
🔴 Branches 51.39% 3433/6680
🔴 Functions 56.77% 2041/3595
🟡 Lines 75.37% 13043/17306

Test suite run success

1707 tests passing in 231 suites.

Report generated by 🧪jest coverage report action from 7441dcc

@katspaugh katspaugh merged commit 6caca1d into dev Dec 16, 2024
16 checks passed
@katspaugh katspaugh deleted the refetch-owned-safes branch December 16, 2024 15:47
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 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.

2 participants