Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • fixed logs search, became dysfunctional once we merged in reactquery hook for logs

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Nov 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Nov 21, 2025 1:15am

@waleedlatif1 waleedlatif1 merged commit 768cdec into staging Nov 21, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/linear branch November 21, 2025 01:16
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 21, 2025

Greptile Overview

Greptile Summary

This PR restores logs search functionality that broke after the React Query hooks were introduced. The fix replaces the simple search parameter with an advanced query parser that:

  • Parses search queries using field:value syntax (e.g., level:error, workflow:"name")
  • Converts structured filters into appropriate API parameters
  • Preserves plain text search for non-structured queries

Key changes:

  • Added import for parseQuery and queryToApiParams from @/lib/logs/query-parser
  • Modified buildQueryParams to parse search queries and convert them to API parameters instead of passing raw search string

The implementation correctly integrates with the existing API endpoint which already supports the parameters generated by queryToApiParams (workflowName, folderName, triggers, level, etc.).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is clean and well-scoped, restoring broken functionality with proper integration between the query parser and existing API. The API endpoint already supports all parameters generated by the parser, ensuring compatibility.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/hooks/queries/logs.ts 5/5 Replaced simple search parameter with advanced query parser that supports field:value syntax and operator-based filtering

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant useLogsList
    participant buildQueryParams
    participant parseQuery
    participant queryToApiParams
    participant API
    
    User->>Component: Enter search query (e.g., "level:error workflow:test")
    Component->>useLogsList: fetchLogsPage(workspaceId, filters, page)
    useLogsList->>buildQueryParams: Build query params with filters
    
    alt Search query exists
        buildQueryParams->>parseQuery: Parse search query string
        parseQuery-->>buildQueryParams: Return ParsedQuery {filters, textSearch}
        buildQueryParams->>queryToApiParams: Convert parsed query to API params
        queryToApiParams-->>buildQueryParams: Return {level, workflowName, search, etc}
        buildQueryParams->>buildQueryParams: Set multiple params from parsed query
    end
    
    buildQueryParams-->>useLogsList: Return query string
    useLogsList->>API: GET /api/logs?{params}
    API-->>useLogsList: Return LogsResponse
    useLogsList-->>Component: Return {logs, hasMore, nextPage}
    Component-->>User: Display filtered logs
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

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.

2 participants