Skip to content

fix(mobile): prevent markdown and file tab reload and screen flicker on retap and revisit - #30033

Merged
nwparker merged 3 commits into
stablyai:mainfrom
zhangxaochen:zhangxaochen/mobile-markdown-tab-flicker
Oct 17, 2026
Merged

nwparker merged 3 commits into
stablyai:mainfrom
zhangxaochen:zhangxaochen/mobile-markdown-tab-flicker

Conversation

@zhangxaochen

@zhangxaochen zhangxaochen commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

On mobile, tapping an already-open Markdown or file tab could replace the document with a loading spinner and reset the editor. Retapping now preserves the view. Returning to a cached tab displays its content immediately while checking the host for updates.

What Changed

Skip activation and reads when the active document is already loaded or loading. Keep clean cached documents visible during refreshes, retain them on refresh failure, and ignore replies from superseded reads or closed tabs. Markdown refreshes also preserve edits and saves made while a read is pending, and apply changes to editing permissions, desktop draft status, and preview truncation even when the text and version match.

Why

Reusing the existing document cache and keeping readers mounted avoids resetting the caret and showing a blank loading state. Refreshing cached tabs in the background still picks up desktop changes; skipping every revisit would leave them stale. Explicitly discarding a phone draft still reloads it.

Linked Issue

Fixes #30031

Visual Proof

Maintainer comparison of the actual mobile readers, rich editor, and tab-switching hooks in a hidden Electron renderer on macOS, with controlled 1.2-second host replies. This is a component harness, not a newly tested Android/iOS build.

Before: retapping the active Markdown tab removes the editor and displays a spinner.

Before: active Markdown retap replaces the document with a spinner

After: retapping retains the same editor and caret, sends no read or activation request, and preserves the measured scroll position (450 px).

After: active Markdown retap keeps the editor visible

Cached Markdown and file content remain visible while revisit reads are pending. A changed host document updates the existing editor, and a failed refresh retains the visible document.

Testing

  • Contributor reports testing the original fix on an Android release APK.
  • Maintainer rendered validation through Playwright CDP in hidden Electron on macOS; no new native-device run.
  • 38 focused tests for retapping, refresh races, metadata changes, disk fallback, and closing documents.
  • Mobile production typecheck, test typecheck ratchet, lint, session formatting, and changed-code quality gate.
  • Full mobile suite: 10,838 tests passed across 1,041 test files; 6 tests intentionally skipped.
  • PR Checks (including verify / PR checks passed) and Mobile Checks passed on 20f362f8a4e72cb211244da97663e5d91381a90f.

Review

Reproduced and corrected two additional issues: unchanged text could hide permission/status changes, and a delayed refresh could overwrite a newer completed phone save. Regression tests failed before those corrections and pass afterward. Existing RPC methods and execution-host routing remain in use, including headless disk fallback and folder workspaces.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied or translated.

Checklist

  • This PR is small and focused
  • Explained the user-facing behavior, mechanism, and choice of approach
  • Before/after visual proof attached
  • Reviewed correctness, security, performance, and cleanup
  • Considered remote hosts, folder workspaces, old-host compatibility, and native/web rendering
  • Full PR and Mobile Checks pass on the final commit

@zhangxaochen

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Pull request base or head changed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nwparker
nwparker merged commit 92999b0 into stablyai:main Oct 17, 2026
22 checks passed
Sign up for free to 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.

[Bug]: Tapping open Markdown or file tab reloads content and causes white screen flicker

2 participants