Skip to content

fix(editor): restore cursor state and prevent tab-switch flash - #2835

Merged
bajrangCoder merged 2 commits into
mainfrom
fix-session-tab-restore
Aug 29, 2026
Merged

fix(editor): restore cursor state and prevent tab-switch flash#2835
bajrangCoder merged 2 commits into
mainfrom
fix-session-tab-restore

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This follow-up restores cursor, scroll, and fold state while preloading persisted tabs without allowing remote requests to block startup.

  • Adds deduplicated EditorFile.load() calls and installs restored selections directly into the loaded document state.
  • Waits for local tab preloads while allowing FTP, SFTP, HTTP, and HTTPS loads to continue asynchronously.
  • Defers restored-fold consumption until loading has completed and preserves pending restoration state during session saves.
  • Adds regression coverage for local preload ordering, non-blocking remote restoration, and pending cursor/fold persistence.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/lib/editorFile.js Adds in-flight load reuse and installs the restored selection into the final document state before marking the file loaded.
src/lib/editorManager.js Applies pending folds only after loading finishes and saves the resulting folded editor state.
src/lib/restoreFiles.js Awaits local preloads but detaches remote loads so unavailable remote services cannot hold startup.
src/lib/saveState.js Persists pending cursor, scroll, and fold values while an asynchronously restored file remains unloaded.
tests/unit/restoreFiles.test.js Covers local preload completion and non-blocking restoration across supported remote URI schemes.
tests/unit/sessionPersistence.test.js Covers persistence of pending folds and remote cursor and scroll state.

Sequence Diagram

sequenceDiagram
  participant Startup
  participant Restore as restoreFiles
  participant Local as Local tabs
  participant Remote as Remote tabs
  participant State as Session persistence
  Startup->>Restore: Restore persisted files
  Restore->>Local: Start preloads
  Restore->>Remote: Start preloads
  Note over Remote: Continue asynchronously
  Local-->>Restore: Local loads complete
  Restore-->>Startup: Restoration complete
  Startup->>State: Enable and save state
  Remote-->>State: Preserve pending view state until loaded
Loading

Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile

Comment thread src/lib/restoreFiles.js Outdated
Comment thread src/lib/editorManager.js Outdated
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder
bajrangCoder added this pull request to the merge queue Aug 29, 2026
Merged via the queue into main with commit 0981172 Aug 29, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Aug 29, 2026
@bajrangCoder
bajrangCoder deleted the fix-session-tab-restore branch August 29, 2026 18:18
@lucasdsc012-hack

Copy link
Copy Markdown

Congratulations Raunak, it turned out great!

@chaiphet6669-afk chaiphet6669-afk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • .

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

项目

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants