Skip to content

fix(logs): close sidebar when selected log disappears from filtered list#4186

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-ui-bug
Apr 15, 2026
Merged

fix(logs): close sidebar when selected log disappears from filtered list#4186
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-ui-bug

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented Apr 15, 2026

Summary

  • Bug fix: Sidebar now closes automatically when the selected log disappears from the filtered list (e.g., clearing an execution ID filter). Uses derived state (effectiveSidebarOpen) instead of a useEffect, avoiding extra render cycles and covering all filter-clearing paths.
  • Cleanup: Removed 12 unnecessary useMemo and 6 useCallback calls from non-memo'd components in the logs module. Replaced a dashboard useEffect state reset with a render-time reset pattern. Fixed CSS variable token usage in the line chart. Added hierarchical statsAll key to the React Query key factory. Added partialize to the log details UI store to prevent persisting transient isResizing state.

Test plan

  • Open logs page, select a log to open the sidebar
  • Apply an execution ID filter, then clear it — sidebar should close
  • Apply status/workflow filters, select a log, clear filters — sidebar should close if log is no longer in list
  • Verify sidebar resize still works and persists width across reloads
  • Verify dashboard chart segment selection resets when filters change
  • Verify notification workflow selector still works

…ist + cleanup

Derive sidebar open state from selection validity instead of using a
separate useEffect. Also removes unnecessary useMemo/useCallback in
non-memo'd components, replaces useEffect with render-time reset in
dashboard, fixes CSS tokens, and adds hierarchical query key factory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 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 15, 2026 7:49pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 15, 2026

PR Summary

Medium Risk
Touches logs selection/sidebar visibility and dashboard segment-selection reset behavior; the new render-time reset logic and derived sidebar state could cause subtle UI regressions if conditions are miscomputed.

Overview
Fixes a logs UX bug by deriving effectiveSidebarOpen so the details sidebar automatically closes when the currently selected log is no longer present in the filtered/sorted list.

Refactors several logs-related components to remove unnecessary useMemo/useCallback usage and simplifies a few computed values, and changes the dashboard segment-selection reset from an effect to a key-based synchronous reset.

Also tweaks styling tokens in the dashboard LineChart, adds a hierarchical React Query key (logKeys.statsAll) for stats invalidation, and updates the persisted log-details UI store to only persist panelWidth (excluding transient isResizing).

Reviewed by Cursor Bugbot for commit f5d6b6f. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 15, 2026

Greptile Summary

This PR fixes a bug where the log details sidebar stayed open when the selected log was filtered out of the list. Instead of using a useEffect to dispatch a close action, it derives effectiveSidebarOpen as isSidebarOpen && selectedLogIndex !== -1, which is simpler and covers all filter-clearing paths in a single expression.

The cleanup work — removing useMemo/useCallback from non-memo'd components, converting the dashboard's useEffect segment-reset to a render-time state update, adding partialize to prevent isResizing from persisting, aligning CSS variable tokens in the line chart, and adding a statsAll() prefix key for targeted invalidation — is all mechanically correct.

Confidence Score: 5/5

Safe to merge — bug fix is correct, all cleanup changes are mechanically sound.

No P0 or P1 findings. The derived-state approach for effectiveSidebarOpen is the cleaner solution. The useCallback/useMemo removals are all in non-memo'd contexts (or inside memo'd components where the removed memos were never passed to child memo'd components). The render-time setState reset in dashboard.tsx follows the documented React pattern and avoids unnecessary resets on polling refreshes. The statsAll() key and partialize additions are straightforward improvements.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/logs/logs.tsx Core bug fix via effectiveSidebarOpen derived state + mass removal of useMemo/useCallback from non-memo'd LogsFilterPanel; all logic is correct.
apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/dashboard.tsx Replaces useEffect with render-time setState reset; valid React pattern, correctly prevents re-renders when only stat values (not workflow IDs) change.
apps/sim/app/workspace/[workspaceId]/logs/components/logs-list/logs-list.tsx Removes useCallback for DOM-only event handlers inside memo'd LogRow; safe because the custom comparator independently governs re-render decisions.
apps/sim/hooks/queries/logs.ts Adds statsAll() prefix key and updates useCancelExecution to use it; hierarchical invalidation is now correct and targeted.
apps/sim/stores/logs/store.ts Adds partialize to exclude transient isResizing from localStorage persistence; correct fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Filter changes] --> B{selectedLogIndex}
    B -- "-1 (log not in list)" --> C[effectiveSidebarOpen = false]
    B -- "≥ 0 (log in list)" --> D[effectiveSidebarOpen = isSidebarOpen]
    C --> E[LogDetails isOpen=false\nSidebar visually closes]
    D --> F{isSidebarOpen}
    F -- true --> G[LogDetails isOpen=true\nSidebar stays open]
    F -- false --> H[LogDetails isOpen=false\nSidebar stays closed]
    E --> I[isSidebarOpen store value\nunchanged — context preserved]
    I --> J{Filter cleared / log\nreappears in list}
    J -- selectedLogIndex ≥ 0 --> G
Loading

Reviews (1): Last reviewed commit: "fix(logs): close sidebar when selected l..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit cd8c5bd into staging Apr 15, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/fix-ui-bug branch April 15, 2026 19:58
Sg312 added a commit that referenced this pull request Apr 15, 2026
…mat, logs performance improvements

fix(csp): add missing analytics domains, remove unsafe-eval, fix workspace CSP gap (#4179)
fix(landing): return 404 for invalid dynamic route slugs (#4182)
improvement(seo): optimize sitemaps, robots.txt, and core web vitals across sim and docs (#4170)
fix(gemini): support structured output with tools on Gemini 3 models (#4184)
feat(brightdata): add Bright Data integration with 8 tools (#4183)
fix(mothership): fix superagent credentials (#4185)
fix(logs): close sidebar when selected log disappears from filtered list; cleanup (#4186)
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