Skip to content

Refactor AddNodeSceneViewModel to use DebouncableTrigger#1709

Merged
DRadmir merged 1 commit intomainfrom
1701-integrate-new-debounce-to-addnodesceneviewmodel
Feb 17, 2026
Merged

Refactor AddNodeSceneViewModel to use DebouncableTrigger#1709
DRadmir merged 1 commit intomainfrom
1701-integrate-new-debounce-to-addnodesceneviewmodel

Conversation

@DRadmir
Copy link
Contributor

@DRadmir DRadmir commented Feb 17, 2026

Separate user input from programmatic actions (paste/scan) using the new DebouncableTrigger pattern for consistent debounce behavior.

Close: #1701

Separate user input from programmatic actions (paste/scan) using the
new DebouncableTrigger pattern for consistent debounce behavior.
@DRadmir DRadmir self-assigned this Feb 17, 2026
@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 refactors the node addition scene to use a more robust and consistent debouncing mechanism. By introducing a DebouncableTrigger pattern, it clearly separates user-driven input changes from programmatic updates (like pasting or scanning), ensuring that the fetching of node information behaves predictably and reliably in all scenarios. This change improves the user experience by preventing unnecessary or premature network requests.

Highlights

  • Refactored Debounce Mechanism: The previous .debounce view modifier has been replaced with a combination of .onChange and a new .debouncedTask modifier, allowing for more granular control over debouncing behavior.
  • Introduced DebouncableTrigger: A new AddNodeFetchTrigger struct, conforming to DebouncableTrigger, was added to explicitly define the trigger for fetching node information, including whether the action should be immediate or debounced.
  • ViewModel Logic Update: The AddNodeSceneViewModel was updated to manage the fetchTrigger property instead of debounceInterval, and its onChangeInput and setInput methods were refactored to utilize this new trigger for consistent debounce behavior across user input and programmatic actions.

🧠 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.

Changelog
  • Features/Settings/Sources/ChainSettings/Scenes/AddNodeScene.swift
    • Replaced the .debounce view modifier with .onChange and .debouncedTask for managing input changes and fetching data.
    • Updated the onClean closure for the input field to reset fetchTrigger instead of debounceInterval.
  • Features/Settings/Sources/ChainSettings/Types/AddNodeFetchTrigger.swift
    • Added a new struct AddNodeFetchTrigger which conforms to DebouncableTrigger to define the parameters for triggering a node fetch.
  • Features/Settings/Sources/ChainSettings/ViewModels/AddNodeSceneViewModel.swift
    • Replaced the debounceInterval property with fetchTrigger of type AddNodeFetchTrigger?.
    • Refactored onChangeInput to set the fetchTrigger for debounced actions.
    • Refactored setInput to set the fetchTrigger for immediate actions.
    • Introduced a private helper method setFetchTrigger to centralize the logic for creating and assigning the fetch trigger based on input validity and immediacy.
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

The pull request successfully refactors the AddNodeSceneViewModel to utilize the new DebouncableTrigger pattern, enhancing consistency in handling debounced actions for user input and programmatic actions like paste/scan. The changes are well-implemented, clearly separating concerns and improving the overall maintainability of the code. The introduction of AddNodeFetchTrigger and the setFetchTrigger private method centralizes the logic for managing fetch triggers, including validation and state updates. This refactoring aligns with the stated objective of the pull request.

@DRadmir DRadmir merged commit 2cb1e77 into main Feb 17, 2026
1 of 2 checks passed
@DRadmir DRadmir deleted the 1701-integrate-new-debounce-to-addnodesceneviewmodel branch February 17, 2026 16:15
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.

Integrate new debounce to AddNodeSceneViewModel

2 participants