Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

This PR fixes the issue in #9285

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Dec 4, 2025
@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

This PR fixes issue #9285 where selecting multiple streams caused the scroll position to reset to the first selected element.

Changes:

  • Added a defensive check for the inputValue property on the q-select component reference before calling updateInputValue("")
  • Applied the fix to both handleMultiStreamSelection() (line 211) and handleSingleStreamSelect() (line 228) methods
  • The condition now checks: indexListSelectField && indexListSelectField.inputValue && indexListSelectField.updateInputValue

Root cause:
When the inputValue property doesn't exist on the q-select component, calling updateInputValue() appears to trigger unwanted side effects that reset the scroll position. By adding this check, the method is only called when inputValue is present, preventing the scroll reset behavior.

Impact:

  • Users can now select multiple streams without the UI jumping back to the first element
  • No functional changes to the stream selection logic itself
  • Maintains backward compatibility

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a simple defensive check that adds an additional guard condition before calling a method. It follows a common pattern of checking property existence before invoking it, which prevents potential errors and unwanted side effects. The fix is minimal, focused, and addresses the specific issue without modifying any core logic or introducing new functionality.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
web/src/plugins/logs/IndexList.vue 5/5 Added defensive check for inputValue property before calling updateInputValue() in stream selection handlers to prevent scroll position reset when multiple streams are selected

Sequence Diagram

sequenceDiagram
    participant User
    participant IndexList as IndexList.vue
    participant QSelect as q-select Component
    participant StreamSelect as streamSelect (ref)
    
    User->>IndexList: Select multiple streams
    IndexList->>IndexList: handleMultiStreamSelection()
    IndexList->>IndexList: $nextTick()
    
    Note over IndexList: Wait for DOM update
    
    IndexList->>StreamSelect: Get ref to streamSelect
    
    alt inputValue exists
        IndexList->>StreamSelect: Check inputValue property
        StreamSelect-->>IndexList: inputValue exists
        IndexList->>StreamSelect: Check updateInputValue method
        StreamSelect-->>IndexList: updateInputValue exists
        IndexList->>StreamSelect: updateInputValue("")
        Note over StreamSelect: Clear filter input without<br/>resetting scroll position
    else inputValue does not exist
        Note over IndexList: Skip updateInputValue call<br/>Prevents scroll reset
    end
    
    IndexList->>IndexList: onStreamChange("")
    Note over IndexList: Process stream change
    
    User->>IndexList: Select single stream
    IndexList->>IndexList: handleSingleStreamSelect(opt)
    IndexList->>IndexList: Update selectedStream
    IndexList->>IndexList: $nextTick()
    
    alt inputValue exists
        IndexList->>StreamSelect: Check inputValue property
        StreamSelect-->>IndexList: inputValue exists
        IndexList->>StreamSelect: updateInputValue("")
        Note over StreamSelect: Clear filter input
    else inputValue does not exist
        Note over IndexList: Skip updateInputValue call
    end
    
    IndexList->>IndexList: onStreamChange("")
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.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@nikhilsaikethe nikhilsaikethe merged commit 2a72fec into main Dec 4, 2025
47 of 54 checks passed
@nikhilsaikethe nikhilsaikethe deleted the fix/issue-9285 branch December 4, 2025 14:01
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