Skip to content

Conversation

@omkarK06
Copy link
Contributor

No description provided.

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

Failed to generate code suggestions for PR

@bjp232004 bjp232004 force-pushed the fix/force-redirect-on-empty-stream-issue-main branch from c2814e4 to 0322342 Compare November 20, 2025 13:23
@omkarK06 omkarK06 force-pushed the fix/force-redirect-on-empty-stream-issue-main branch 3 times, most recently from 95b9ddf to 20a526c Compare November 21, 2025 11:48
@bjp232004 bjp232004 closed this Dec 1, 2025
@omkarK06 omkarK06 reopened this Dec 4, 2025
@omkarK06 omkarK06 force-pushed the fix/force-redirect-on-empty-stream-issue-main branch from 20a526c to 6e04ada Compare December 4, 2025 12:04
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 4, 2025

Greptile Overview

Greptile Summary

Fixed logs redirection issue caused by empty stream objects by initializing stream state to null instead of empty objects and adding optional chaining throughout the codebase.

Key Changes:

  • Changed initial state from {} to null for all stream types (logs, metrics, traces, enrichment_tables, index, metadata)
  • Added optional chaining (?.) before array index access in getMultiStreams and setStreams functions to safely handle null values
  • Fixed property name from areStreamsFetched to areAllStreamsFetched in test

Issue Found:

  • Duplicate assignment in isStreamFetched function (lines 394-395) where line 395 overwrites line 394's value

Confidence Score: 4/5

  • Safe to merge with one minor logic issue that should be addressed
  • The PR correctly addresses the empty streams redirection bug by changing initialization from empty objects to null. The optional chaining additions are appropriate and safe. However, there's a duplicate assignment in the isStreamFetched function that should be fixed - line 394 is immediately overwritten by line 395, making it redundant code
  • Pay attention to web/src/composables/useStreams.ts - duplicate assignment on lines 394-395

Important Files Changed

File Analysis

Filename Score Overview
web/src/stores/streams.ts 5/5 Changed initial state from empty objects to null for all stream types - clean and correct fix
web/src/composables/useStreams.ts 3/5 Added optional chaining to handle null values, but contains duplicate assignment in isStreamFetched function (lines 394-395)
web/src/composables/useStreams.spec.ts 5/5 Updated test to use correct property name areAllStreamsFetched and fixed trailing whitespace

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant Store as Vuex Store
    participant useStreams as useStreams Composable
    participant Cache as streamsCache

    Note over Store: BEFORE: Initial state = {}
    Note over Store: AFTER: Initial state = null

    App->>useStreams: isStreamFetched(streamType)
    useStreams->>Cache: Check streamsCache[streamType]?.value?.list
    
    alt Stream state is null (NEW behavior)
        Cache-->>useStreams: Returns undefined
        useStreams-->>App: Returns false (not fetched)
    else Stream state is {} (OLD behavior)
        Cache-->>useStreams: {}.list = undefined
        useStreams-->>App: Returns false (not fetched)
    end

    App->>useStreams: getStream(name, type, schema)
    useStreams->>useStreams: Check if stream fetched
    useStreams->>Store: Access streamsIndexMapping[streamType][streamName]
    useStreams->>Cache: streamsCache[streamType].value?.list?.[index]
    
    Note over useStreams,Cache: Optional chaining (?.) prevents<br/>errors when value is null
    
    Cache-->>useStreams: Return stream or {}
    useStreams-->>App: Stream data
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.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@omkarK06 omkarK06 force-pushed the fix/force-redirect-on-empty-stream-issue-main branch from 6e04ada to d529be6 Compare December 5, 2025 13:04
@omkarK06 omkarK06 force-pushed the fix/force-redirect-on-empty-stream-issue-main branch from d529be6 to bc8e2e7 Compare December 5, 2025 13:35
@omkarK06 omkarK06 force-pushed the fix/force-redirect-on-empty-stream-issue-main branch from d0ad30c to ce28a83 Compare December 5, 2025 13:39
@omkarK06 omkarK06 merged commit af668b9 into main Dec 5, 2025
53 of 56 checks passed
@omkarK06 omkarK06 deleted the fix/force-redirect-on-empty-stream-issue-main branch December 5, 2025 14:17
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.

3 participants