Skip to content

Conversation

@DRadmir
Copy link
Contributor

@DRadmir DRadmir commented Dec 29, 2025

Moved the call to set the current wallet after dismissing the onboarding view in both CreateWalletModel and ImportWalletViewModel. This ensures the wallet is set after the UI is dismissed, potentially preventing race conditions or UI inconsistencies.

Moved the call to set the current wallet after dismissing the onboarding view in both CreateWalletModel and ImportWalletViewModel. This ensures the wallet is set after the UI is dismissed, potentially preventing race conditions or UI inconsistencies.
@DRadmir DRadmir requested a review from gemdev111 December 29, 2025 06:55
@DRadmir DRadmir self-assigned this Dec 29, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a potential issue where the current wallet might be set before the onboarding view is fully dismissed, leading to race conditions or UI inconsistencies. By reordering the dismiss() and walletService.setCurrent() calls in the CreateWalletModel and ImportWalletViewModel, the change ensures a more robust and predictable user experience during the wallet creation and import processes.

Highlights

  • Wallet Setup Order: The order of operations for setting the current wallet and dismissing the onboarding view has been reversed in both CreateWalletModel and ImportWalletViewModel.
  • Race Condition Prevention: The change ensures that the onboarding UI is dismissed before the walletService.setCurrent call is made, which helps prevent potential race conditions or UI inconsistencies.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the wallet setup completion logic in CreateWalletModel and ImportWalletViewModel. By moving the call to walletService.setCurrent(wallet:) to after the dismiss() call, it correctly ensures that the UI dismissal is initiated before the current wallet state is updated. This is a good practice to prevent potential race conditions and UI inconsistencies that could arise from updating state on a view that is about to be dismissed. The changes are clear, concise, and improve the robustness of the onboarding flow. I've added a minor suggestion regarding the throws keyword on the setCurrent method for future consideration.

func setupWalletComplete(wallet: Wallet) async throws {
try await walletService.setCurrent(wallet: wallet)
dismiss()
try await walletService.setCurrent(wallet: wallet)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While the reordering is correct, I noticed that walletService.setCurrent(wallet:) is marked as throws, which necessitates the use of try here. Looking at the implementation in WalletService.swift, the function doesn't seem to have any throwing paths. It might be beneficial to remove throws from the function signature to avoid unnecessary try keywords at call sites. This could be addressed in a separate refactoring effort.

func setupWalletComplete(wallet: Wallet) async throws {
try await walletService.setCurrent(wallet: wallet)
dismiss()
try await walletService.setCurrent(wallet: wallet)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the other view model, the reordering is a good improvement. I also noticed here that walletService.setCurrent(wallet:) is marked as throws, but its implementation doesn't appear to throw. For consistency and code clarity, it might be worth considering removing throws from its signature in a future change, which would allow removing try from this call.

@DRadmir DRadmir merged commit fbc6df9 into main Dec 29, 2025
3 checks passed
@DRadmir DRadmir deleted the fix-creation-wallet-delay branch December 29, 2025 16:27
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.

3 participants