-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(terminal): persist collapsed state across page refresh #3023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryPrevents terminal from auto-opening on page refresh by tracking initialization state and skipping the first sync after console hydration. Changes
How it WorksThe fix uses a flag pattern to distinguish between:
The Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Browser
participant Terminal
participant Store
participant Effect
Note over Browser,Store: Page Refresh / Initial Load
Browser->>Store: Rehydrate terminal state
Store-->>Browser: terminalHeight, console entries
Browser->>Terminal: Mount component
Terminal->>Effect: Run auto-open effect
alt Console not yet hydrated
Effect->>Effect: hasConsoleHydrated = false
Effect->>Effect: Exit early
end
alt First run after hydration
Effect->>Effect: hasInitializedEntriesRef = false
Effect->>Effect: Set hasInitializedEntriesRef = true
Effect->>Effect: Store current length
Effect->>Effect: Skip auto-open (prevent opening on hydrated entries)
end
Note over User,Effect: New Workflow Run
User->>Terminal: Execute workflow
Terminal->>Store: Add console entry
Store->>Terminal: New entry added
Terminal->>Effect: allWorkflowEntries.length increased
alt openOnRun enabled & terminal collapsed
Effect->>Terminal: expandToLastHeight()
Terminal->>Store: setTerminalHeight(lastExpandedHeight)
Store->>Browser: Update CSS variable
Browser->>User: Terminal expands
end
Note over User,Effect: Switch Workflows
User->>Terminal: Navigate to different workflow
Terminal->>Effect: activeWorkflowId changed
Effect->>Effect: Reset hasInitializedEntriesRef = false
Effect->>Effect: Re-initialize for new workflow
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx
Outdated
Show resolved
Hide resolved
03aa239 to
e653ebd
Compare
|
@greptile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
Summary
Type of Change
Testing
Tested manually
Checklist