fix(terminal): persist collapsed state across page refresh#3023
Merged
waleedlatif1 merged 2 commits intostagingfrom Jan 27, 2026
Merged
fix(terminal): persist collapsed state across page refresh#3023waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
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.
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
Collaborator
Author
|
@greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Tested manually
Checklist