Skip to content

Commit

Permalink
fix(IT Wallet): [SIW-695] Fix credentials issuing checks error naviga…
Browse files Browse the repository at this point in the history
…tion (#5237)

## Short description
This PR proposes a fix for the credential catalog screen not navigating
to the checks result screen on error.
The issue comes from the condition on the navigation `pot.isNone` which
evaluates to true when the pot is in `NoneError` state, thus preventing
the navigation to the result screen.

## List of changes proposed in this pull request
- Removes the `pot.isNone` condition leaving only `pot.isLoading`. This
is sufficient because we only want to navigate when the pot is not in a
loading state and the loading index is not `-1`.
If the pot is `none`, when the user opens the catalog, the condition
will still fail due to the loading index being none.
If the pot is `noneError` after the user selects a credential, then the
navigation happens due to the loading index being different from none.
However, if the pot is `noneError` because an error occurred and the
user lands again in the credential catalog, the navigation won't happen
because the loading index is being none.

## How to test
Check if obtaining a credential still works properly and also check if
the "already existing credential" error is shown.
  • Loading branch information
LazyAfternoons committed Nov 20, 2023
1 parent a91af12 commit 47f5529
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ const ItwCredentialCatalogScreen = () => {
* when the user goes back from the credential checks screen.
*/
useEffect(() => {
if (
loadingIndex !== NONE_LOADING &&
!pot.isLoading(preliminaryChecks) &&
!pot.isNone(preliminaryChecks)
) {
setLoadingIndex(-1);
if (loadingIndex !== NONE_LOADING && !pot.isLoading(preliminaryChecks)) {
navigation.navigate(ITW_ROUTES.CREDENTIAL.ISSUING.CHECKS);
setLoadingIndex(NONE_LOADING);
}
}, [loadingIndex, navigation, preliminaryChecks]);

Expand Down

0 comments on commit 47f5529

Please sign in to comment.