Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • added reactquery hooks for workflow operations,
  • added reactquery hooks for logs,
    • fixed logs reloading
  • fix subscription UI bug

Type of Change

  • Bug fix
  • New feature

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 16, 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 16, 2025 0:39am

…l from free, updated providers that supported granular tool control to support them, fixed envvar popover, fixed redirect to wrong workspace after oauth connect
…r logs, fixed logs reloading, fix subscription UI
@waleedlatif1 waleedlatif1 marked this pull request as ready for review November 16, 2025 00:12
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 16, 2025

Greptile Overview

Greptile Summary

This PR migrates workflow and logs operations to React Query for better caching and performance, adds workflow import functionality, and fixes subscription UI styling.

Key Changes

  • Migrated workflow/folder/logs data fetching to React Query hooks with proper cache management
  • Added comprehensive workflow import supporting JSON and ZIP files with folder structure preservation
  • Removed 200+ lines of manual fetch logic from logs component
  • Fixed subscription button styling to remove problematic hover transitions

Critical Issue

  • Pagination bug in useLogsList hook (logs.ts:150-155): The hook always replaces logs instead of appending when loading more pages, breaking infinite scroll functionality. The setLogs call needs to check filters.page > 1 to determine if logs should be appended.

Confidence Score: 3/5

  • This PR has a critical pagination bug that will break logs infinite scroll
  • Score reflects one critical bug in logs pagination that will cause functional issues. The infinite scroll will not work correctly - when users scroll to load more logs, page 2+ will replace page 1 instead of appending. The rest of the changes are well-structured React Query migrations with proper patterns.
  • apps/sim/hooks/queries/logs.ts requires immediate attention to fix pagination logic

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/hooks/queries/logs.ts 2/5 Added React Query hooks for logs fetching. Critical pagination bug: logs are always replaced instead of appended for infinite scroll.
apps/sim/hooks/queries/workflows.ts 5/5 Added React Query hooks for workflow operations with proper optimistic updates and cache invalidation.
apps/sim/hooks/queries/folders.ts 5/5 Added React Query hooks for folder CRUD operations with proper cache management.
apps/sim/app/workspace/[workspaceId]/logs/logs.tsx 3/5 Refactored to use React Query hooks, removing manual fetch logic. Pagination logic relies on broken useLogsList hook.
apps/sim/app/workspace/[workspaceId]/w/hooks/use-import-workflow.ts 5/5 Implemented comprehensive workflow import supporting single/multiple JSON files and ZIP archives with folder structure preservation.

Sequence Diagram

sequenceDiagram
    participant User
    participant LogsPage as Logs Component
    participant ReactQuery as React Query
    participant LogsHook as useLogsList Hook
    participant Store as Filter Store
    participant API as /api/logs

    User->>LogsPage: Scrolls to bottom
    LogsPage->>LogsPage: loadMoreLogs() called
    LogsPage->>Store: setPage(page + 1)
    Store-->>LogsPage: page updated
    Note over LogsPage,ReactQuery: Page change triggers query refetch
    ReactQuery->>LogsHook: Query refetch with new page
    LogsHook->>API: GET /api/logs?page=2&limit=50
    API-->>LogsHook: Returns {logs: [...], hasMore: true}
    LogsHook->>Store: setLogs(logs) - BUG: replaces instead of appends!
    Store-->>LogsPage: Logs replaced (should append)
    LogsPage->>User: Shows only page 2 logs (page 1 lost)
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.

20 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 5f446ad into staging Nov 16, 2025
4 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/logs branch November 16, 2025 00:41
waleedlatif1 added a commit that referenced this pull request Nov 17, 2025
* test(pr): hackathon (#1999)

* test(pr): github trigger (#2000)

* fix(usage-indicator): conditional rendering, upgrade, and ui/ux (#2001)

* fix: usage-limit indicator and render conditonally on is billing enabled

* fix: upgrade render

* fix(notes): fix notes, tighten spacing, update deprecated zustand function, update use mention data to ignore block positon (#2002)

* fix(pdfs): use unpdf instead of pdf-parse (#2004)

* fix(modals): fix z-index for various modals and output selector and variables (#2005)

* fix(condition): treat condition input the same as the code subblock (#2006)

* feat(models): added gpt-5.1 (#2007)

* improvement: runpath edges, blocks, active (#2008)

* feat(i18n): update translations (#2009)

* fix(triggers): check triggermode and consolidate block type (#2011)

* fix(triggers): disabled trigger shouldn't be added to dag (#2012)

* Fix disabled blocks

* Comments

* Fix api/chat trigger not found message

* fix(tags): only show start block upstream if is ancestor (#2013)

* fix(variables): Fix resolution on double < (#2016)

* Fix variable <>

* Ling

* Clean

* feat(billing): add notif for first failed payment, added upgrade email from free, updated providers that supported granular tool control to support them, fixed envvar popover, fixed redirect to wrong workspace after oauth connect (#2015)

* feat(billing): add notif for first failed payment, added upgrade email from free, updated providers that supported granular tool control to support them, fixed envvar popover, fixed redirect to wrong workspace after oauth connect

* fix build

* ack PR comments

* feat(performance): added reactquery hooks for workflow operations, for logs, fixed logs reloading, fix subscription UI (#2017)

* feat(performance): added reactquery hooks for workflow operations, for logs, fixed logs reloading, fix subscription UI

* use useInfiniteQuery for logs fetching

* fix(copilot): run workflow supports input format and fix run id (#2018)

* fix(router): fix error edge in router block + fix source handle problem (#2019)

* Fix router block error port handling

* Remove comment

* Fix edge execution

* improvement: code subblock, action bar, connections (#2024)

* improvement: action bar, connections

* fix: code block draggable resize

* fix(response): fix response block http format (#2027)

* Fix response block

* Lint

* fix(notes): fix notes block spacing, additional logs for billing transfer route (#2029)

---------

Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
Co-authored-by: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com>
Sg312 pushed a commit that referenced this pull request Nov 18, 2025
…r logs, fixed logs reloading, fix subscription UI (#2017)

* feat(performance): added reactquery hooks for workflow operations, for logs, fixed logs reloading, fix subscription UI

* use useInfiniteQuery for logs fetching
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