You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CheckWallet component is a critical component that wraps almost every button in the app to decide whether that button should be enabled or not. It checks for several conditions like the user wallet, the safe setup and multiple permissions like delegates and spending limits. This component grew over time, has a high complexity and is hard to extend and maintain.
In some cases we have buttons where we only want to ensure that any wallet is connected. In order to achieve this we have additional flags that are passed to CheckWallet like allowNonOwner
The list of requirements
I suggest to split the condition up into multiple hooks that are composed and conditionally used inside CheckWallet e.g.
Furthermore, having to change something about permissions would only touch a single hook instead of the whole component where the rest of the logic lies.
Designs/sketches
Current conditions
The text was updated successfully, but these errors were encountered:
Another idea: If we can determine that there are a fix amount of variants we could also split up CheckWallet into multiple components like CheckWalletConnected etc. and use those more specific components instead of one big one.
What is the feature about
The
CheckWallet
component is a critical component that wraps almost every button in the app to decide whether that button should be enabled or not. It checks for several conditions like the user wallet, the safe setup and multiple permissions like delegates and spending limits. This component grew over time, has a high complexity and is hard to extend and maintain.In some cases we have buttons where we only want to ensure that any wallet is connected. In order to achieve this we have additional flags that are passed to
CheckWallet
likeallowNonOwner
The list of requirements
I suggest to split the condition up into multiple hooks that are composed and conditionally used inside
CheckWallet
e.g.With the above and wanting to skip permission and safe status check it would look like this:
Furthermore, having to change something about permissions would only touch a single hook instead of the whole component where the rest of the logic lies.
Designs/sketches
Current conditions
The text was updated successfully, but these errors were encountered: