Skip to content

improvement(execution-snapshot): enhance workflow preview in logs and deploy modal - #2742

Merged
waleedlatif1 merged 15 commits into
stagingfrom
improvement/workflow-preview
Jan 9, 2026
Merged

improvement(execution-snapshot): enhance workflow preview in logs and deploy modal#2742
waleedlatif1 merged 15 commits into
stagingfrom
improvement/workflow-preview

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • enhance workflow preview in logs and deploy modal
  • added reactquery cache for logs details, used in logs & deploy modal

Type of Change

  • 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

vercelBot commented Jan 9, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentReviewUpdated (UTC)
docsSkippedSkippedJan 9, 2026 7:04am

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR enhances the workflow preview functionality in logs and deploy modals by introducing a comprehensive execution snapshot feature with React Query caching. The changes replace the legacy FrozenCanvas component with a new ExecutionSnapshot component that provides interactive workflow visualization with execution data.

Key Changes

New Features:

  • Execution Snapshot Component: Interactive workflow state viewer with block details sidebar, execution status highlighting, and support for migrated logs
  • React Query Integration: Added useExecutionSnapshot hook with 5-minute cache and useLogDetail hook with 30-second cache for improved performance
  • Block Details Sidebar: Comprehensive readonly sidebar showing block configuration, execution input/output, resolved variable references, and connection visualization
  • Workflow Preview Enhancements: Added execution status support for blocks and edges, lightweight mode for template cards, and improved memoization

Refactoring:

  • State Management: Refactored logs page from object-based to ID-based log selection for better React Query integration
  • Color Consolidation: Moved user color utilities from w/utils/get-user-color.ts to centralized lib/workspaces/colors.ts
  • EMCN Components: Updated checkbox, slider, and switch to use data-[disabled] attribute instead of disabled: pseudo-class for Radix UI compatibility

Architecture:

  • New reusable preview component structure in app/workspace/[workspaceId]/w/components/preview/
  • Proper separation between full-featured blocks and lightweight preview blocks
  • Integration with existing workflow editor components via readonly mode

Issues Found

One minor style issue was identified:

  • Import pattern inconsistency in block.tsx (importing from @/blocks/registry instead of @/blocks)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-structured with proper error handling, loading states, and React Query caching patterns. The refactoring from FrozenCanvas to ExecutionSnapshot is complete and properly integrated. State management changes in logs.tsx improve data flow. Color consolidation eliminates code duplication. EMCN component updates align with Radix UI best practices. Only one minor style issue (import pattern inconsistency) was found, which doesn't affect functionality.
  • apps/sim/app/workspace/[workspaceId]/w/components/preview/components/block.tsx - Contains a minor import pattern inconsistency that should be aligned with other files in the same directory

Important Files Changed

File Analysis

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/execution-snapshot/execution-snapshot.tsx5/5New component for rendering workflow execution snapshots with React Query integration, proper loading/error states, and modal support
apps/sim/hooks/queries/logs.ts5/5Added useExecutionSnapshot hook with 5-minute staleTime and useLogDetail hook with 30-second staleTime for React Query caching
apps/sim/hooks/queries/workflows.ts5/5Added useDeploymentVersionState and useRevertToVersion hooks for deployment version management with proper caching
apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx5/5Enhanced WorkflowPreview with execution status support, lightweight mode for performance, and proper memoization
apps/sim/app/workspace/[workspaceId]/w/components/preview/components/block-details-sidebar.tsx4/5New comprehensive sidebar for block details with execution data, resolved connections, and readonly preview mode with proper CSS overrides
apps/sim/app/workspace/[workspaceId]/w/components/preview/components/block.tsx4/5New lightweight preview block component with minor import pattern inconsistency (uses @/blocks/registry instead of @/blocks)
apps/sim/lib/workspaces/colors.ts5/5Consolidated color utilities from multiple locations into single source of truth for user and presence colors
apps/sim/app/workspace/[workspaceId]/logs/logs.tsx5/5Refactored log selection state from object-based to ID-based management, added preview modal support, improved React Query integration
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/general/general.tsx5/5Enhanced with BlockDetailsSidebar integration, expanded preview modal, and proper version state management
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-edge/workflow-edge.tsx5/5Added support for preview execution status from edge data, improved edge styling logic for execution states

Sequence Diagram

sequenceDiagram
participant User
participant LogsPage as Logs Page
participant LogDetails as Log Details Sidebar
participant ExecutionSnapshot as Execution Snapshot
participant LogsQuery as useExecutionSnapshot Hook
participant API as /api/logs/execution
participant WorkflowPreview as Workflow Preview
participant BlockSidebar as Block Details Sidebar
User->>LogsPage: Click log row
LogsPage->>LogDetails: Open sidebar with log
LogDetails->>LogDetails: Display log metadata
User->>LogDetails: Click "View Snapshot"
LogDetails->>ExecutionSnapshot: Open modal (isModal=true)
ExecutionSnapshot->>LogsQuery: Request execution snapshot
LogsQuery->>API: GET /api/logs/execution/{executionId}
Note over LogsQuery,API: Cached for 5 minutes (staleTime)
API-->>LogsQuery: Return workflowState + metadata
LogsQuery-->>ExecutionSnapshot: Provide data
alt Migrated State
ExecutionSnapshot->>User: Show "Logged State Not Found" warning
else Valid State
ExecutionSnapshot->>WorkflowPreview: Render with workflowState
WorkflowPreview->>WorkflowPreview: Calculate nodes/edges with execution status
WorkflowPreview->>User: Display interactive canvas
User->>WorkflowPreview: Click block
WorkflowPreview->>BlockSidebar: Open sidebar with block details
BlockSidebar->>BlockSidebar: Resolve variable references
BlockSidebar->>User: Show execution data, input/output, connections
User->>BlockSidebar: Click close
BlockSidebar->>WorkflowPreview: Clear pinned block
end
User->>ExecutionSnapshot: Close modal
ExecutionSnapshot->>LogDetails: Return to log details
Loading

@greptile-apps

Copy link
Copy Markdown
Contributor
Additional Comments (1)

apps/sim/app/workspace/[workspaceId]/w/components/preview/components/block.tsx
Inconsistent import pattern detected. This file imports getBlock from '@/blocks/registry', but other files in the same directory (block-details-sidebar.tsx and preview.tsx) import it from '@/blocks'.

According to the codebase patterns, @/blocks/index.ts re-exports from @/blocks/registry, so importing from '@/blocks' is the established pattern.

import { getBlock } from '@/blocks'

This maintains consistency with the rest of the preview components and follows the repository's import conventions.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/workspace/[workspaceId]/w/components/preview/components/block.tsx
Line: 6:6
Comment:
Inconsistent import pattern detected. This file imports `getBlock` from `'@/blocks/registry'`, but other files in the same directory (`block-details-sidebar.tsx` and `preview.tsx`) import it from `'@/blocks'`. According to the codebase patterns, `@/blocks/index.ts` re-exports from `@/blocks/registry`, so importing from `'@/blocks'` is the established pattern.
```suggestionimport { getBlock } from '@/blocks'```
This maintains consistency with the rest of the preview components and follows the repository's import conventions.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.

@waleedlatif1
waleedlatif1 merged commit 554dcdf into stagingJan 9, 2026
6 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/workflow-preview branch January 9, 2026 07:05
Sign up for freeto 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

@waleedlatif1