Skip to content

Conversation

@nicoschmdt
Copy link
Contributor

@nicoschmdt nicoschmdt commented Feb 9, 2026

fix #1884

Summary by Sourcery

New Features:

  • Introduce automatic dismissal timeouts for snackbar alerts varying by message level (success/info, warning, others).

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 9, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Implements level-based auto-dismiss timeouts for Alerter snackbars instead of keeping them open indefinitely.

Class diagram for updated Alerter snackbar timeout logic

classDiagram
  class Alerter {
    +boolean show
    +string message
    +MessageLevel level
    +string type
    +number timeout
  }

  class MessageLevel {
    <<enumeration>>
    Success
    Info
    Warning
    Error
  }

  Alerter --> MessageLevel : uses

  class AlerterTypeComputed {
    +string type()
  }

  class AlerterTimeoutComputed {
    +number timeout()
  }

  AlerterTypeComputed <|-- Alerter : implements
  AlerterTimeoutComputed <|-- Alerter : implements

  class TimeoutBehavior {
    +number forSuccess
    +number forInfo
    +number forWarning
    +number forError
  }

  TimeoutBehavior : forSuccess = 5000
  TimeoutBehavior : forInfo = 5000
  TimeoutBehavior : forWarning = 7000
  TimeoutBehavior : forError = -1

  Alerter --> TimeoutBehavior : applies_by_level
Loading

File-Level Changes

Change Details Files
Make snackbar timeout dynamic and dependent on message severity level.
  • Replace hard-coded snackbar timeout of -1 with a bound timeout property
  • Introduce a computed timeout value that varies by message level (shorter for success/info, longer for warnings, none for errors/critical)
core/frontend/src/components/app/Alerter.vue

Assessment against linked issues

Issue Objective Addressed Explanation
#1884 Add an automatic timeout to bottom notification snackbars so that at least success messages (and similar transient messages) auto-dismiss instead of requiring manual closing.
#1884 Keep the snackbar behavior configurable/optional so that not all message types are forced to auto-dismiss (i.e., some can remain persistent).

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • Consider extracting the timeout values (5000, 7000, -1) into named constants or a small mapping object so the timing semantics are clearer and easier to adjust in one place.
  • It might be helpful to add a brief inline comment or enum-like mapping indicating that -1 is used for an indefinite snackbar to make the special behavior explicit for future readers.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the timeout values (5000, 7000, -1) into named constants or a small mapping object so the timing semantics are clearer and easier to adjust in one place.
- It might be helpful to add a brief inline comment or enum-like mapping indicating that `-1` is used for an indefinite snackbar to make the special behavior explicit for future readers.

## Individual Comments

### Comment 1
<location> `core/frontend/src/components/app/Alerter.vue:52-60` </location>
<code_context>
           return 'info'
       }
     },
+    timeout(): number {
+      switch (this.level) {
+        case MessageLevel.Success:
+        case MessageLevel.Info:
+          return 5000
+        case MessageLevel.Warning:
+          return 7000
+        default:
+          return -1
+      }
+    },
</code_context>

<issue_to_address>
**suggestion:** Avoid magic numbers for timeouts by extracting named constants or documenting their intent.

Using raw `5000` and `7000` obscures their meaning (e.g., default vs. warning timeout). Please extract them into named constants (e.g., `SUCCESS_INFO_TIMEOUT_MS`, `WARNING_TIMEOUT_MS`) or a small `MessageLevel`-keyed map so the intent is clear and easier to adjust later.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +52 to +60
timeout(): number {
switch (this.level) {
case MessageLevel.Success:
case MessageLevel.Info:
return 5000
case MessageLevel.Warning:
return 7000
default:
return -1
Copy link

Choose a reason for hiding this comment

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

suggestion: Avoid magic numbers for timeouts by extracting named constants or documenting their intent.

Using raw 5000 and 7000 obscures their meaning (e.g., default vs. warning timeout). Please extract them into named constants (e.g., SUCCESS_INFO_TIMEOUT_MS, WARNING_TIMEOUT_MS) or a small MessageLevel-keyed map so the intent is clear and easier to adjust later.

@patrickelectric patrickelectric merged commit b1ebd1d into bluerobotics:master Feb 9, 2026
5 checks passed
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.

Bottom notifications (snackbars) should have an optional timeout

2 participants