Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

No description provided.

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

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 10, 2025

Greptile Overview

Greptile Summary

Fixed a browser-specific bug where column reordering in the logs view would behave unpredictably in Firefox when colOrder was empty.

  • Added early return in reorderSelectedFields() when colOrder is empty to prevent unstable sort behavior in Firefox
  • Refactored reorderArrayByReference() to return a new sorted array instead of mutating the input array
  • Added proper return statement to ensure reorderSelectedFields() returns the reordered result

Confidence Score: 5/5

  • This PR is safe to merge - it's a targeted bug fix with minimal code changes.
  • The changes are small, focused, and fix a legitimate browser-specific sorting bug. The refactored code follows better practices (immutability) and properly handles the edge case of an empty colOrder array.
  • No files require special attention.

Important Files Changed

File Analysis

Filename Score Overview
web/src/composables/useLogs.ts 5/5 Fixed Firefox unstable sort issue by adding early return when colOrder is empty, and made reorderArrayByReference return a new sorted array instead of mutating in place.

Sequence Diagram

sequenceDiagram
    participant User
    participant SearchResult/IndexList
    participant reorderSelectedFields
    participant reorderArrayByReference

    User->>SearchResult/IndexList: Interact with logs view
    SearchResult/IndexList->>reorderSelectedFields: Call reorderSelectedFields()
    reorderSelectedFields->>reorderSelectedFields: Get selectedFields (filtered)
    reorderSelectedFields->>reorderSelectedFields: Get colOrder (filtered)
    
    alt colOrder is empty
        reorderSelectedFields-->>SearchResult/IndexList: Return selectedFields unchanged (NEW FIX)
    else colOrder has items
        alt selectedFields !== colOrder
            reorderSelectedFields->>reorderArrayByReference: Call with selectedFields, colOrder
            reorderArrayByReference->>reorderArrayByReference: Sort copy by colOrder indices
            reorderArrayByReference-->>reorderSelectedFields: Return sorted array (NEW FIX)
            reorderSelectedFields-->>SearchResult/IndexList: Return reordered fields
        else selectedFields === colOrder
            reorderSelectedFields-->>SearchResult/IndexList: Return selectedFields unchanged
        end
    end
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 8caeea3 into branch-v0.30.0 Dec 10, 2025
38 checks passed
@nikhilsaikethe nikhilsaikethe deleted the fix/issue-reorder-0.30 branch December 10, 2025 05:16
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