-
Notifications
You must be signed in to change notification settings - Fork 107
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
feat(IT Wallet): [SIW-1638] Handle unknown credential status #6576
base: master
Are you sure you want to change the base?
Conversation
Jira Pull Request LinkThis Pull Request refers to the following Jira issue SIW-1638 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6576 +/- ##
==========================================
+ Coverage 49.29% 49.31% +0.01%
==========================================
Files 1555 1559 +4
Lines 32122 32151 +29
Branches 7267 7274 +7
==========================================
+ Hits 15834 15854 +20
- Misses 16250 16259 +9
Partials 38 38
Continue to review full report in Codecov by Sentry.
|
const colorProps = useMemo(() => { | ||
const baseColorProps = mapCredentialTypes[credentialType]; | ||
if (!baseColorProps) { | ||
return; | ||
} | ||
if (colorScheme === "greyscale") { | ||
return { | ||
foreground: Color(baseColorProps.foreground).grayscale().hex(), | ||
background: Color(baseColorProps.background).grayscale().hex() | ||
}; | ||
} | ||
}; | ||
return baseColorProps; | ||
}, [credentialType, colorScheme]); |
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.
Just a little note: this useMemo
is a bit redundant and does not provide any benefit. colorProps
depends on the same props as the component, it will be recalculated every time the component re-renders anyway.
Keeping the memoization has negligible overhead, tho.
Feel free to do what you think is most appropriate!
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.
You are right, I have removed two useMemo
that were dependent on all the component props (2f0a36e).
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.
LGTM
Short description
This PR handles unexpected failures of the status attestation call. When that happens (for instance because of network problems), it is not possibile to determine the status of a credential. This "unknown" status is reflected in the UI and the credential detail cannot be accessed.
List of changes proposed in this pull request
unknown
ingetCredentialStatus
(previously an unknown status attestation would returnvalid
)ItwCredentialCard
to display the greyed-out cardHow to test
The easiest way to test this PR is by mocking the result of the
/status
endpoint so that it returns 500.