Skip to content

selectmodal bug fixed#1106

Draft
himanshuranjan007 wants to merge 3 commits into
NEAR-DevHub:mainfrom
himanshuranjan007:modalbug
Draft

selectmodal bug fixed#1106
himanshuranjan007 wants to merge 3 commits into
NEAR-DevHub:mainfrom
himanshuranjan007:modalbug

Conversation

@himanshuranjan007

Copy link
Copy Markdown

fixes #1098

two changes made in select-modal
useRef(false) flag that is set to true on first invocation , immediately any subsequent calls while the flag is set to true
& useEffect resets to false whenever isOpen becomes true

Screen.Recording.2026-07-14.at.12.02.24.PM.mov

Copilot AI review requested due to automatic review settings July 14, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes the Deposit flow’s asset selector flicker (Issue #1098) by guarding against rapid double-clicks causing duplicate selection/close state transitions in SelectModal.

Changes:

  • Added a useRef-based “selection in progress” guard to ignore repeated selection handler invocations.
  • Reset the guard when the modal opens (isOpen becomes true) to allow selection in the next open session.

Comment thread nt-fe/app/(treasury)/[treasuryId]/dashboard/components/select-modal.tsx Outdated
@frol

frol commented Jul 15, 2026

Copy link
Copy Markdown
Member

I feel that we might need to look deeper into the problem as I don't want to fix symptoms instead of the root cause. Also, the issue itself is quite odd in the first place, so I don't want to bring a symptomatic hotfix for the issue that only occurs if the user does some odd things.

As pointed out by Copilot review, this hotfix did not account for the multiselect case and as such this fix for a corner case would break a multiselect case, which is a much more severe problem, and who knows what else would it break.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 08:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines +79 to +84
// Reset the guard whenever the modal opens so it's ready for the next session.
useEffect(() => {
if (isOpen) {
isSelectingRef.current = false;
}
}, [isOpen]);
Comment on lines +123 to +127
// Prevent a rapid double-click from triggering the handler twice (single-select only).
// For multi-select we must allow multiple item clicks while the modal remains open.
if (!multiSelect) {
if (isSelectingRef.current) return;
isSelectingRef.current = true;

@frol frol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See my comment and the Copilot review as well

@frol
frol marked this pull request as draft July 15, 2026 09:06
Copilot AI review requested due to automatic review settings July 17, 2026 04:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

[BUG] Trezu - Deposit: Asset selector briefly reopens after double-clicking an asset

3 participants