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: onboarding gate in ledger mode #4871

Merged
merged 1 commit into from
Jan 26, 2024
Merged

fix: onboarding gate in ledger mode #4871

merged 1 commit into from
Jan 26, 2024

Conversation

alter-eggo
Copy link
Contributor

@alter-eggo alter-eggo commented Jan 26, 2024

Try out this version of Leather — Extension build, Test report

Adds redirect back to home screen if user has ledger keys and tries go back to welcome page

Screen.Recording.2024-01-26.at.19.47.50.mov

@alter-eggo alter-eggo added this pull request to the merge queue Jan 26, 2024
Merged via the queue into dev with commit 07729b5 Jan 26, 2024
28 checks passed
@alter-eggo alter-eggo deleted the fix/go-back-ledger branch January 26, 2024 16:02

if (
keyDetails?.type === 'software' &&
hasAlreadyMadeWalletAndPlaintextKeyInMemory(keyDetails.encryptedSecretKey, currentInMemoryKey)
(keyDetails?.type === 'software' &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This works but it's very tricky to read with somewhat of a ternary and function call inside of an if.

I'd go for a small refactor to make it easier to understand

const isLedger = useHasLedgerKeys();
const hasKeyInMemory = hasAlreadyMadeWalletAndPlaintextKeyInMemory(
        keyDetails.encryptedSecretKey,
        currentInMemoryKey
      );
const canGoHome = (keyDetails?.type === 'software' && hasKeyInMemory) || isLedger;

  if (canGoHome){
...

For now lets leave it as is, working well but in future I think small refactors like that are worth it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

completely agree here, just was in a hurry a bit

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah thats fine, and understandable! nice job getting it fixed so quickly 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants