Skip to content

improvement: workflow loading, sidebar scrolling - #2322

Merged
emir-karabeg merged 11 commits into
stagingfrom
improvement/loading
Dec 16, 2025
Merged

improvement: workflow loading, sidebar scrolling#2322
emir-karabeg merged 11 commits into
stagingfrom
improvement/loading

Conversation

@emir-karabeg

@emir-karabegemir-karabeg commented Dec 12, 2025

Copy link
Copy Markdown
Collaborator

Summary

Optimizing loading, workflow operations, fixing s-modal, fixing footer link.

Type of Change

  • Bug fix
  • New feature

Testing

@icecrasher321, @emir-karabeg, and @waleedlatif1

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 Dec 12, 2025

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentReviewUpdated (UTC)
docsSkippedSkippedDec 16, 2025 3:14am

@greptile-apps

greptile-appsBot commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR implements comprehensive performance optimizations focused on workflow loading and user interaction smoothness. The key changes include eliminating duplicate API calls for billing data across organization queries, introducing lazy loading for non-critical components (Chat and OAuth modal), and implementing a sophisticated drag optimization system using local displayNodes state to prevent store updates during drag operations. The PR also standardizes loading spinners across the application by replacing icon-based loaders with consistent CSS spinners, fixes scrolling issues in the s-modal sidebar, addresses SSR hydration issues with Radix UI components, and optimizes store subscriptions using useShallow() to reduce unnecessary re-renders. Additional improvements include socket connection optimizations, better canvas readiness management, and UI consistency fixes like proper background styling and footer link categorization. These changes collectively improve the workflow editing experience by making node dragging smoother, reducing initial load times, and eliminating performance bottlenecks during complex workflow operations.

Important Files Changed

FilenameScoreOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx4/5Major performance refactor with lazy loading, local displayNodes state for smooth dragging, and optimized store subscriptions
apps/sim/stores/workflows/workflow/store.ts5/5Optimized updateBlockPosition function by removing unnecessary edge spreading and lastSaved updates during drag
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-edge/workflow-edge.tsx5/5Performance optimization with memo wrapper, useShallow subscriptions, and useMemo for expensive calculations
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-current-workflow.ts5/5Added shallow comparison to store subscriptions and simplified state access for better performance
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/settings-modal.tsx5/5Removed duplicate billing API call from organization query to optimize loading performance
apps/sim/hooks/queries/organization.ts5/5Eliminated redundant billing data fetch from fetchOrganizations function
apps/sim/app/workspace/providers/socket-provider.tsx4/5Optimized socket connection by removing blocking token generation from initialization
apps/sim/components/emcn/components/s-modal/s-modal.tsx5/5Fixed sidebar scrolling by adding min-h-0 and overflow-y-auto classes
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx5/5Added client-side hydration protection for Radix Popover component
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx5/5Simplified auto-scroll logic with boolean flag instead of per-workflow ID tracking
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/team-management.tsx5/5Switched to use userSubscriptionData instead of billing data from organizationsData
apps/sim/app/workspace/page.tsx5/5Replaced Loader2 icon with CSS spinner for consistency
apps/sim/app/workspace/[workspaceId]/w/page.tsx5/5Updated loading state with CSS spinner and restructured layout to match workflow page
apps/sim/app/workspace/[workspaceId]/layout.tsx5/5Added background color using CSS variable for consistent theming
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/layout.tsx5/5Changed background from Tailwind class to CSS variable for dynamic theming
apps/sim/app/(landing)/components/footer/consts.ts5/5Moved 'Guardrails' from FOOTER_TOOLS to FOOTER_BLOCKS for correct categorization
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/training-modal/training-modal.tsx5/5File relocation from training-controls to dedicated training-modal directory

Confidence score: 4/5

  • This PR contains well-executed performance optimizations that should significantly improve workflow loading and interaction smoothness
  • Score reflects the complexity of the drag optimization system and lazy loading implementation which, while well-designed, introduces new patterns that need careful monitoring
  • Pay close attention to the workflow.tsx changes as they introduce local state management for drag operations and lazy loading patterns that could affect user experience if not properly handled

Sequence Diagram

sequenceDiagram
participant User
participant Browser
participant Router
participant SidebarStore
participant WorkflowStore
participant WorkflowRegistry
participant Server
User->>Browser: "Click sidebar collapse button"
Browser->>SidebarStore: "setIsCollapsed(!isCollapsed)"
SidebarStore->>SidebarStore: "Update isCollapsed state"
alt When collapsing sidebar
SidebarStore->>Browser: "Update CSS variable --sidebar-width to 0"
Browser->>User: "Show floating collapsed header"
else When expanding sidebar
SidebarStore->>Browser: "Update CSS variable --sidebar-width to stored width"
Browser->>User: "Show full sidebar"
end
User->>Browser: "Navigate to workspace page"
Browser->>Router: "Route to /workspace/[workspaceId]/w"
Router->>WorkflowRegistry: "Fetch workflows for workspace"
WorkflowRegistry->>Server: "GET /api/workflows"
Server-->>WorkflowRegistry: "Return workflow list"
WorkflowRegistry->>Router: "workflows loaded"
Router->>Browser: "Redirect to first workflow"
User->>Browser: "Create new workflow"
Browser->>WorkflowStore: "handleCreateWorkflow()"
WorkflowStore->>Server: "POST /api/workflows"
Server-->>WorkflowStore: "Return new workflow ID"
WorkflowStore->>Browser: "Navigate to new workflow"
Browser->>Browser: "Scroll sidebar to new workflow"
User->>Browser: "Resize sidebar"
Browser->>SidebarStore: "setSidebarWidth(newWidth)"
SidebarStore->>Browser: "Update CSS variable --sidebar-width"
Browser->>User: "Visual sidebar width change"
User->>Browser: "Search workflows (⌘K)"
Browser->>Browser: "Open search modal"
User->>Browser: "Select workflow from search"
Browser->>Router: "Navigate to selected workflow"
Loading

@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.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@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.

13 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@emir-karabeg

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@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.

16 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@emir-karabeg

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@emir-karabeg
emir-karabeg merged commit 0e6a131 into stagingDec 16, 2025
10 checks passed
@emir-karabeg
emir-karabeg deleted the improvement/loading branch December 16, 2025 03:21

@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.

17 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

3 participants

@emir-karabeg@waleedlatif1@icecrasher321