-
Notifications
You must be signed in to change notification settings - Fork 566
Refactor(web): use TypedData type from the @safe-global/utils package #5536
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
Conversation
Branch preview✅ Deploy successful! Storybook: |
Coverage (27%)
|
📦 Next.js Bundle Analysis for @safe-global/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟡 | Statements | 76.86% (-0% 🔻) |
14670/19087 |
🔴 | Branches | 55.56% (-0.02% 🔻) |
3764/6775 |
🟡 | Functions | 61.2% | 2158/3526 |
🟡 | Lines | 78.3% (-0.01% 🔻) |
13304/16991 |
Show files with reduced coverage 🔻
St.❔ |
File | Statements | Branches | Functions | Lines |
---|---|---|---|---|---|
🟡 | ... / safe-message-guards.ts |
66.67% (-4.76% 🔻) |
100% | 50% | 75% (-5% 🔻) |
🟢 | ... / SignMessage.tsx |
91.67% (-0.08% 🔻) |
82.35% | 69.23% | 92.38% (-0.07% 🔻) |
🟢 | ... / index.tsx |
88.89% (-0.4% 🔻) |
92.86% | 75% | 95.83% (-0.17% 🔻) |
🟢 | ... / useSafeMessageNotifications.ts |
86.89% (-0.21% 🔻) |
78.26% | 100% | 87.5% (-0.22% 🔻) |
🟢 | ... / index.tsx |
96.88% (-0.09% 🔻) |
73.33% (+9.7% 🔼) |
100% | 96.77% (-0.1% 🔻) |
🟢 | ... / index.tsx |
94.12% | 47.06% (-6.27% 🔻) |
50% | 93.75% |
🟡 | ... / index.tsx |
76% (-0.92% 🔻) |
45.45% | 33.33% | 75% (-1% 🔻) |
Test suite run success
1803 tests passing in 253 suites.
Report generated by 🧪jest coverage report action from d0026a3
@@ -46,7 +46,7 @@ const MsgDetails = ({ msg }: { msg: SafeMessage }): ReactElement => { | |||
<EthHashInfo | |||
address={msg.proposedBy.value || ''} | |||
name={msg.proposedBy.name} | |||
customAvatar={msg.proposedBy.logoUri} | |||
customAvatar={msg.proposedBy.logoUri || undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaiu logoUri now has the type of string | null | undefined
. Is there a benefit of having a fallback here instead of adjusting the EthHashInfo
type to also accept null
as a value for customAvatar
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although thinking about it it makes sense to change it here instead of everywhere downstream so we don't have to deal with a null value in potentially many components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. The EthHashInfo component has specific requirements. if you pass a prop to it, it should be a string, otherwise you should not pass a customAvatar. The component defines concrete function arguments.
I'm not sure changing the function arguments should be done, because an API we use might return an incompatible type.
On the other hand I agree that it is a bit weird, but not sure that deserves changing the EthHashInfo component.
apps/web/src/components/safe-messages/MsgSigners/MsgSigners.test.tsx
Outdated
Show resolved
Hide resolved
The types for balances were reverted as they cause lint errors
The codemod migrates old safe-gateway-typescript-sdk to the new @safe-global/store types
ffa3db4
to
a27645b
Compare
a27645b
to
d0026a3
Compare
What it solves
Refactors the usage of the old types to the new ones. Why? Because the new ones are "more correct & auto-generated" and the mobile app already uses them. If we want to reuse code, types need to match, otherwise all hell breaks lose and developers loose their sanity & joy of life.
Resolves #
How this PR fixes it
There is a codemod that maps old types to new types and also exchanges the use of the old enum types. After running the script I went through the files and did manual modifications that were necessary for the types to be correctly used
How to test it
Everything should continue to work as before. Unit tests and e2e tests should catch any errors.
Screenshots
Checklist