Skip to content

improvement(logs): fix trigger badge wrapping, time range picker, status filters, and React anti-patterns#4207

Merged
waleedlatif1 merged 3 commits intostagingfrom
fix/logs-ui
Apr 17, 2026
Merged

improvement(logs): fix trigger badge wrapping, time range picker, status filters, and React anti-patterns#4207
waleedlatif1 merged 3 commits intostagingfrom
fix/logs-ui

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Fix trigger badge wrapping to single line via whitespace-nowrap
  • Fix time range date picker bug — remove DropdownMenu wrapper, use DatePicker controlled popover
  • Remove "Cancelling" from status filter options (intermediary state, added filterable flag to STATUS_CONFIG)
  • Add dev-only mock logs for integration trigger testing (__dev__/mock-logs.ts, tree-shaken in prod)
  • Convert 6 useMemo display labels to inline expressions in logs-toolbar (no observer = no benefit)
  • Stabilize getSuggestions callback in logs.tsx to fix memo chain instability
  • Fix design token: replace hsl(var(--muted-foreground)) with text-[var(--text-muted)] in line-chart
  • workflow-block: use subBlock.type instead of subBlock.id for workflow/table selector display name lookup

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
Copy Markdown

vercel bot commented Apr 17, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 17, 2026 0:48am

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 17, 2026

PR Summary

Low Risk
Primarily UI/UX and state-management adjustments around logs filtering and rendering, with limited blast radius. Main risk is subtle regressions in date-picker open/close behavior or which statuses appear in filters.

Overview
Improves the Logs UI filtering and display by making status filters exclude intermediary states (adds filterable to STATUS_CONFIG and only exposes those options) and by preventing trigger/status badges from wrapping via whitespace-nowrap.

Fixes time-range filtering UX by replacing the DropdownMenu-wrapped date range picker with a controlled DatePicker popover (including apply-vs-cancel handling via dateRangeAppliedRef) in both the toolbar and filter panel.

Includes small React correctness/cleanup tweaks: stabilizes the search suggestion callback, simplifies derived label computations, makes refresh spinner behavior reusable, and corrects selector display-name lookups to key off subBlock.type (workflow/table selectors). Also normalizes the generated tool schema map keys to plain object properties (no computed key syntax).

Reviewed by Cursor Bugbot for commit 4ec1fa3. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 17, 2026

Greptile Summary

This PR fixes several bugs in the logs feature: the stale-closure time-range revert (via dateRangeAppliedRef), incorrect workflow/table selector display-name lookups (now matching on subBlock.type instead of subBlock.id), and the "Cancelling" state appearing as a filterable status option. It also stabilizes the getSuggestions callback reference and replaces six useMemo display-label computations with inline expressions where memoization provided no benefit.

Confidence Score: 5/5

Safe to merge — all core bugs are correctly fixed; only a redundant double-call on Cancel remains as a non-functional P2.

The three main bugs (stale-closure Apply revert, workflow/table selector type matching, Cancelling filter option) are all correctly addressed. The dateRangeAppliedRef pattern is sound, getSuggestions stabilization is correct, and the subBlock.type fix is a strict improvement. The only remaining issue (handleDatePickerCancel called twice on Cancel) is idempotent and produces no observable difference in behavior.

logs-toolbar.tsx and logs.tsx — double-cancel call on the Cancel button path, P2 only.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/logs-toolbar.tsx Fixes stale-closure Apply revert via dateRangeAppliedRef; replaces DropdownMenu wrapper with controlled DatePicker — Cancel path now invokes handleDatePickerCancel twice (once via onCancel, once via onOpenChange else branch).
apps/sim/app/workspace/[workspaceId]/logs/logs.tsx Same DatePicker migration and dateRangeAppliedRef fix as toolbar; getSuggestions wrapped in useCallback for memo stability; triggerVisualRefresh extracted correctly; same double-cancel call pattern present in LogsFilterPanel.
apps/sim/app/workspace/[workspaceId]/logs/utils.ts Adds filterable flag to STATUS_CONFIG correctly excluding cancelling; StatusBadge/TriggerBadge de-memoized to plain functions; whitespace-nowrap added to all TriggerBadge variants.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx Correct semantic fix: subBlock.type (workflow-selector / table-selector) replaces brittle subBlock.id string matching for display-name lookups.
apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/line-chart/line-chart.tsx One-line design-token fix: inline style replaced with Tailwind CSS variable class.
apps/sim/lib/copilot/generated/tool-schemas-v1.ts Purely cosmetic: computed property names (['agent']) converted to identifier shorthand (agent); no semantic change.

Sequence Diagram

sequenceDiagram
    participant User
    participant DatePicker
    participant Toolbar
    participant FilterStore

    User->>DatePicker: Click Apply
    DatePicker->>Toolbar: onRangeChange(start, end)
    Toolbar->>Toolbar: dateRangeAppliedRef.current = true
    Toolbar->>FilterStore: setDateRange(start, end)
    Toolbar->>Toolbar: setDatePickerOpen(false) [queued]
    DatePicker->>Toolbar: onOpenChange(false)
    Toolbar->>Toolbar: ref=true → reset ref, skip cancel ✓

    User->>DatePicker: Click Cancel
    DatePicker->>Toolbar: onCancel() → handleDatePickerCancel() [1st]
    DatePicker->>Toolbar: onOpenChange(false) → handleDatePickerCancel() [2nd, redundant]

    User->>DatePicker: Click Outside / Escape
    DatePicker->>Toolbar: onOpenChange(false)
    Toolbar->>Toolbar: ref=false → handleDatePickerCancel() ✓
Loading

Reviews (2): Last reviewed commit: "fix(logs): prevent DatePicker onOpenChan..." | Re-trigger Greptile

Comment thread apps/sim/app/workspace/[workspaceId]/logs/logs.tsx
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

Re: Greptile bug report — Good catch. onOpenChange(false) fires synchronously when setDatePickerOpen(false) is called inside handleDateRangeApply, at which point the Zustand state update from setDateRange hasn't re-rendered yet, so the startDate in the handleDatePickerCancel closure is still undefined. Fixed in 4ec1fa3 by setting a dateRangeAppliedRef flag inside handleDateRangeApply before closing — onOpenChange checks the flag and skips the cancel logic when Apply was the trigger. Applied to both DatePicker usages (toolbar + filter panel).

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4ec1fa3. Configure here.

@waleedlatif1 waleedlatif1 merged commit 49a1495 into staging Apr 17, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/logs-ui branch April 17, 2026 01:01
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.

1 participant