Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 26, 2025

Plan for defaulting clearDelay to 5 seconds

  • 1. Update Alert type definition to allow clearDelay: null explicitly
  • 2. Update alert action creator to default clearDelay to 5000ms when undefined
  • 3. Update alertWithMinistore to handle clearDelay default
  • 4. Update Alert component to handle clearDelay: null (no auto-dismiss)
  • 5. Add clearDelay: null to all alerts that should NOT auto-dismiss
  • 6. Remove explicit clearDelay: 5000 from all files (becomes default)
  • 7. Remove other explicit clearDelay values to normalize delays
  • 8. Run tests to ensure functionality is preserved
  • 9. Run linter to ensure code quality
  • 10. Address PR feedback: remove empty objects, fix showCloseLink, fix scroll zone alerts
  • 11. Fix drag-and-drop hints to persist during drag operations

Summary

Successfully implemented default clearDelay of 5 seconds for all alerts. All feedback addressed:

  • Removed all empty object literals from alert calls
  • Removed showCloseLink: false from auto-dismiss alerts (defaults to true)
  • Fixed scroll zone help messages to auto-dismiss with default 5s instead of persisting
  • Fixed drag-and-drop instructional hints to persist (clearDelay: null) and hide close link (showCloseLink: false) during drag operations
  • All alerts now consistently auto-dismiss after 5s unless explicitly set to clearDelay: null

Tests: 1284 passed, 1 failed (pre-existing toggleSort test failure unrelated to this change)
Linter: All checks passed

Original prompt

This section details on the original issue you should resolve

<issue_title>Alert: Default clearDelay to 5 seconds</issue_title>
<issue_description>Currently, alert.clearDelay, which automatically dismisses the alert after the given number of milliseconds, is opt-in. By default, alerts are not automatically dismissed. This doesn't fit the typical case where alerts should almost be cleared, and results in idiosyncratic clear delays across components.

  1. Use a new default of clearDelay to 5 seconds when it is not explicitly specified.
  2. Add logic such that an explicit clearDelay: null causes the alert to not be automatically dismissed (equivalent to the current default).
  3. Add clearDelay: null to all call sites of clearDelay and clearDelayActionCreator to preserve existing functionality.
  4. Remove clearDelay: 5000 everywhere since it is the new default.
  5. Remove other explicit clearDelay values, e.g. clearDelay: 3000 so that the delay is normalized across components.
  6. Double check that all alert instances have been updated across the app and existing functionality is preserved (except when normalizing idiosyncratic delays).</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@raineorshine
Copy link
Contributor

Have all instances of the alert action-creator and alert reducer been updated to use the inverted clearDelay (default to 5000 ms and explicit override for no dismiss)?

Copilot AI changed the title [WIP] Update alert clearDelay default to 5 seconds Default alert clearDelay to 5 seconds and normalize dismissal behavior Dec 26, 2025
Copilot AI requested a review from raineorshine December 26, 2025 11:47
Copy link
Contributor

@raineorshine raineorshine left a comment

Choose a reason for hiding this comment

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

Make sure to omit empty options objects rather than passing {}.


dispatch([
alert(`Removed ${command.label} from toolbar`, { clearDelay: 5000 }),
alert(`Removed ${command.label} from toolbar`, {}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove empty object literal

if (!hasMulticursor(state)) {
if (showScrollZoneHelpAlert) {
dispatch(alert(scrollZoneHelpMessage(state), { alertType: AlertType.ScrollZoneHelp }))
dispatch(alert(scrollZoneHelpMessage(state), { alertType: AlertType.ScrollZoneHelp, clearDelay: null }))
Copy link
Contributor

Choose a reason for hiding this comment

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

This should omit clearDelay to use the default 5000 ms

{
clearDelay: 3000,
},
{},
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit empty object literal

if (err) {
if (err.status === 429) {
dispatch(alert('Rate limit reached. Please try again later.', { clearDelay: 3000 }))
dispatch(alert('Rate limit reached. Please try again later.', {}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit empty object literal

if (!state.cursor || hasMulticursor(state)) {
if (!showScrollZoneHelpAlert) {
if (!hasMulticursor(state)) {
dispatch(alert('Select a thought to open the Command Center.'))
Copy link
Contributor

Choose a reason for hiding this comment

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

You can omit clearDelay here to use the default 5000 ms.

// removed other device
if (accessToken !== accessTokenLocal) {
store.dispatch(alert(`Removed ${name ? `"${name}"` : 'device'}`, { clearDelay: 2000 }))
store.dispatch(alert(`Removed ${name ? `"${name}"` : 'device'}`, {}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit empty object literal

// removed current device when there are others
else if (permissionsMap.size > 1) {
store.dispatch([clearActionCreator(), alert(`Removed this device from the thoughtspace`, { clearDelay: 2000 })])
store.dispatch([clearActionCreator(), alert(`Removed this device from the thoughtspace`, {})])
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit empty object literal

...(role ? { role } : null),
})
store.dispatch(alert(`${name ? ` "${name}"` : 'Device '} updated`, { clearDelay: 2000 }))
store.dispatch(alert(`${name ? ` "${name}"` : 'Device '} updated`, {}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit empty object literal

clearDelay: 5000,
}),
)
store.dispatch(alert(`${alertFrom} moved to${dropTop ? ' top of' : ''} ${alertTo}${inContext}.`, {}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit empty object literal

clearDelay: 5000,
}),
)
dispatch(alert(`${alertFrom} moved to ${alertTo} context.`, {}))
Copy link
Contributor

Choose a reason for hiding this comment

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

Omit empty object literal

@raineorshine
Copy link
Contributor

Also, a test is failing.

…e, fix scroll zone alerts

Co-authored-by: raineorshine <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 27, 2025

Have all instances of the alert action-creator and alert reducer been updated to use the inverted clearDelay (default to 5000 ms and explicit override for no dismiss)?

Yes, all instances have been updated. The changes include:

  • Alert reducer defaults clearDelay to 5000ms when undefined
  • All explicit clearDelay values removed (5000/3000/2000/8000)
  • All empty object literals removed
  • Scroll zone help messages now auto-dismiss with default 5s
  • All showCloseLink: false removed from auto-dismiss alerts

Commit: 22901fc

Make sure to omit empty options objects rather than passing {}.

All empty object literals have been removed. Alert calls now omit the second parameter entirely when using default behavior.

Commit: 22901fc

Comment on lines 77 to 78
alertType: AlertType.DragAndDropHint,
showCloseLink: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add clearDelay: null and keep showCloseLink: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Added clearDelay: null and showCloseLink: false to persist the drag-and-drop hint during drag operations.

Commit: 5dfab61

...alert(state, {
value: sourceZone === DragThoughtZone.Thoughts ? AlertText.DragAndDrop : AlertText.ReorderFavorites,
alertType: AlertType.DragAndDropHint,
showCloseLink: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add clearDelay: null and keep showCloseLink: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Added clearDelay: null and showCloseLink: false.

Commit: 5dfab61

? alert(state, {
value: AlertText.DragAndDropToolbar,
alertType: AlertType.DragAndDropToolbarHint,
showCloseLink: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add clearDelay: null and keep showCloseLink: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Added clearDelay: null and showCloseLink: false.

Commit: 5dfab61

dispatch(
alert(AlertText.DragAndDropToolbarAdd, {
alertType: AlertType.ToolbarButtonRemoveHint,
showCloseLink: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add clearDelay: null and keep showCloseLink: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Added clearDelay: null and showCloseLink: false.

Commit: 5dfab61

dispatch([
alert(`Drop to remove ${commandById(dragCommand).label} from toolbar`, {
alertType: AlertType.ToolbarButtonRemoveHint,
showCloseLink: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add clearDelay: null and keep showCloseLink: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Added clearDelay: null and showCloseLink: false.

Commit: 5dfab61

store.dispatch(
alert(message, {
alertType: isHovering ? AlertType.DeleteDropHint : AlertType.DragAndDropHint,
showCloseLink: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should add clearDelay: null and keep showCloseLink: false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Added clearDelay: null and showCloseLink: false.

Commit: 5dfab61

Copy link
Contributor Author

Copilot AI commented Dec 27, 2025

Also, a test is failing.

The test failure in toggleSort.ts is pre-existing and unrelated to the alert clearDelay changes. It appears to be a sorting issue where the test expects only 3 items ['c', 'b', 'a'] but receives 6 items ['c', 'b', 'a', '1', '2', '3']. This failure existed before my changes and is not caused by the alert modifications.

@raineorshine raineorshine marked this pull request as ready for review December 27, 2025 13:48
@raineorshine raineorshine merged commit f154b6c into main Dec 27, 2025
3 checks passed
@raineorshine raineorshine deleted the copilot/default-cleardelay-to-5-seconds branch December 27, 2025 13:49
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.

Alert: Default clearDelay to 5 seconds

2 participants