Skip to content

Prevent multiselect indicator alert from auto-dismissing on desktop#4546

Open
BayuAri with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-multiselect-auto-dismissal
Open

Prevent multiselect indicator alert from auto-dismissing on desktop#4546
BayuAri with Copilot wants to merge 6 commits into
mainfrom
copilot/fix-multiselect-auto-dismissal

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

On desktop, activating multiselect showed a "N thought(s) selected" indicator alert that auto-dismissed after 5s. Because closing the MulticursorActive alert also deselects all thoughts, the entire selection was silently cleared.

Root cause

multicursorAlertMiddleware dispatched the MulticursorActive alert without a clearDelay, so alertReducer defaulted it to 5000ms. When the timer fired, alertActionCreator(null) cleared the alert and — per alert.ts, which runs clearMulticursors on closing that alert type — wiped the selection too.

Changes

  • src/redux-middleware/multicursorAlertMiddleware.ts — pass clearDelay: null for the MulticursorActive alert, using the existing "prevent auto-dismiss" mechanism:

    throttledAlert(dispatch, `${numMulticursors} thoughts selected`, {
      alertType: AlertType.MulticursorActive,
      clearDelay: null,
    })

    The indicator now persists while a selection is active. It is still cleared when the selection reaches zero (existing !numMulticursors branch) or manually via the alert's Cancel button.

  • src/e2e/puppeteer/__tests__/multiselect.ts — regression test asserting the alert and highlighted bullet remain after 6s (past the old 5s timeout).

Notes for review

With clearDelay: null, Notification's onClose prop becomes undefined, so the hover-X close affordance no longer appears — dismissal is intended to go through the dedicated Cancel link. Other alert types are unaffected and keep their 5s default.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Vercel preview: https://em-bmnl3jw3b-cybersemics.vercel.app

Copilot AI and others added 2 commits July 9, 2026 02:00
Co-authored-by: BayuAri <8419585+BayuAri@users.noreply.github.com>
Co-authored-by: BayuAri <8419585+BayuAri@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix multiselect dismissal timing issue Prevent multiselect indicator alert from auto-dismissing on desktop Jul 9, 2026
Copilot AI requested a review from BayuAri July 9, 2026 02:14

@BayuAri BayuAri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Original issue is fixed.
Multiselect remains until manually dismissed

There is a small issue on the alert.

  • Close button on the Alert is not working
  • Cancel copy message is not centered aligned.

@raineorshine
As mentioned on this comment, that the New Liminal UI won't have this alert, can we leave above issues as is for now?

Comment on lines +42 to +43
// wait past the default 5000ms alert auto-dismiss timeout
await sleep(6000)

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.

Never sleep in tests. This will slow the test suite down for everyone on the team.

You should mock the timeout to 0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the 6s sleep. The test now shortens the default alert auto-dismiss timeout via a new testFlags.alertClearDelay (set to 1ms), so a regression would clear the selection immediately and be caught fast. The multiselect alert must still persist because it is dispatched with clearDelay: null. Verified the test fails against a reverted fix.

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.

This is not scalable. We can't have a dedicated testFlag for every alert in the app.

We should probably globally mock the clear delay to Infinite when it is set at all. Then we can manually clear the alert as needed, otherwise assume it hasn't been dismissed yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 277501a — dropped the per-alert flag and the sleep. Auto-dismiss is now globally disabled in tests via testFlags.preventAutoDismiss (set in setup.ts), which mocks finite clearDelays to Infinity. The test asserts state.alert.clearDelay === null for the multiselect indicator, which catches a revert (it resolves to Infinity otherwise).

Comment thread src/e2e/puppeteer/__tests__/multiselect.ts Outdated
@raineorshine

raineorshine commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@copilot Please address the review feedback.

@raineorshine
As mentioned on this comment, that the New Liminal UI won't have this alert, can we leave above issues as is for now?

Yes

@raineorshine raineorshine marked this pull request as ready for review July 9, 2026 18:53
…ect regression test

Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
Copilot AI requested a review from raineorshine July 9, 2026 19:10
@raineorshine

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

@raineorshine raineorshine 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.

Comment thread src/e2e/testFlags.ts Outdated
Comment on lines +8 to +9
/** Overrides the default alert auto-dismiss delay (in ms). Used to shorten the timeout in tests so that auto-dismiss regressions can be detected quickly without a long sleep. */
alertClearDelay: number | null

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.

This is not scalable. We can't have a dedicated testFlag for every alert in the app.

We should probably globally mock the clear delay to Infinite when it is set at all. Then we can manually clear the alert as needed, otherwise assume it hasn't been dismissed yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaced the per-alert alertClearDelay with a global testFlags.preventAutoDismiss (277501a). When set, alertReducer mocks any finite clearDelay to Infinity, so alerts never auto-dismiss in tests — enabled globally in setup.ts, so tests can assume an alert is present until manually cleared. An explicit clearDelay: null stays null, keeping it distinguishable from a would-have-dismissed alert, which is what the multiselect regression now asserts (verified it fails with Infinity when the fix is reverted).

Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflict with main in src/e2e/puppeteer/__tests__/multiselect.ts (kept both the auto-dismiss regression test and main's new Select All copy tests). Lint, affected unit tests, and all 5 puppeteer multiselect tests pass. Merge commit 747bbc1.

…entAutoDismiss mock

Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
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.

[Chrome] Multiselect is auto dismissed after 5 secs

3 participants