Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

while saving realtime alert if we have no groups then we are getting console error

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Dec 2, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 2, 2025

Greptile Overview

Greptile Summary

Fixed console error when saving realtime alerts with no groups by adding optional chaining to safely access groups.value.items in the hasOnlyOneCondition computed property.

  • Added optional chaining (?.) to groups.value.items.filter() calls on lines 433-434
  • Added optional chaining to conditions.length and subGroups.length checks on line 437
  • Prevents TypeError when groups.value or groups.value.items is null/undefined during component initialization

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a simple defensive coding fix that adds optional chaining to prevent console errors. The fix is minimal, targeted, and follows JavaScript best practices for null/undefined safety. No logic changes or side effects introduced.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
web/src/components/alerts/FilterGroup.vue 5/5 Added optional chaining to prevent console errors when groups or items are undefined in hasOnlyOneCondition computed property

Sequence Diagram

sequenceDiagram
    participant User
    participant RealTimeAlert
    participant FilterGroup
    participant hasOnlyOneCondition
    
    User->>RealTimeAlert: Save alert with no groups
    RealTimeAlert->>FilterGroup: Pass conditions prop
    Note over FilterGroup: groups.value initialized from props.group
    FilterGroup->>hasOnlyOneCondition: Compute value
    Note over hasOnlyOneCondition: groups?.value?.items?.filter()
    alt groups or items is null/undefined
        hasOnlyOneCondition-->>FilterGroup: Returns undefined (safe)
    else groups and items exist
        hasOnlyOneCondition-->>FilterGroup: Returns boolean
    end
    FilterGroup->>User: Renders without console error
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nikhilsaikethe nikhilsaikethe merged commit 4ba53b1 into branch-v0.20.0 Dec 2, 2025
17 of 18 checks passed
@nikhilsaikethe nikhilsaikethe deleted the fix/console-error-real-timealert branch December 2, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants