Repository navigation
Remember Markdown TOC state while tabs are open - #6476
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 2f5916ed031b37246f3eed15161d99c114aa7eaf and b54d0e9b4d968611d3b6b10aa2eb3e38fb3ab1b4. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughMarkdown table-of-contents visibility is moved from component-local state into the editor slice and keyed by markdown document state. The slice adds a per-file visibility map, a setter, and cleanup logic for preview replacement, file close, and close-all flows. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 74bdb356-0956-4335-90be-e2400a60ccbc
📥 Commits
Reviewing files that changed from the base of the PR and between 360ce67 and 2f5916ed031b37246f3eed15161d99c114aa7eaf.
📒 Files selected for processing (3)
src/renderer/src/components/editor/EditorPanel.tsxsrc/renderer/src/store/slices/editor.test.tssrc/renderer/src/store/slices/editor.ts
|
Addressed in b54d0e9b4. The shared preview-replacement helper now clears Markdown frontmatter and TOC visibility for orphaned replaced-preview keys, while preserving source-file visibility when another open preview still references it. Added focused tests for both drop and preserve cases. |
b54d0e9 to
a371c89
Compare
|
Took ownership of this PR — rebased onto latest DescriptionThe Markdown table-of-contents open/closed state lived in Evidence
ELI5The little table-of-contents panel for a Markdown file used to forget whether you'd opened it the moment you clicked to another tab. Now the app remembers that choice per file, so it's still open when you come back — and it tidily forgets the setting once you close the file for good. Trade-offsNo user-visible regression. TOC visibility now persists for the lifetime of an open document (previously it reset on every unmount) — that's the intended fix. The state is bounded: entries are keyed by open-file id, removed on close/replace when no longer referenced, and Rebased + pushed |
…fix garbled comments (#7322) Quality pass on renderer/shared PRs merged 2026-07-03: - WorktreeTitleInlineRename: skip the truncation measure + ResizeObserver in `wrapTitle` mode, where wrapped titles never truncate — it could only churn unused state (#7307). - editor slice: reuse the `removeEditorStateForReplacedPreview` helper this PR added instead of a hand-rolled copy of the same six-field eviction (drops ~50 lines) (#6476). - useFileExplorerTree: extract `readWorktreeDirectory` so the connectionId/settings assembly for `readRuntimeDirectory` lives in one place, not three (#6321). - comment-markdown-github-attachment-media: extract a shared `AttachmentFallbackLink` for the image/video error-fallback link (#6759). - repository-icon-github: fold the two near-identical live resolvers into one parameterized `resolveRepositoryIdentityLive`; trim a 3-line comment to 2 (#6507). - resource-usage-open-slices: delete the `shouldReadPopoverSlices` identity wrapper and inline `open` at the four call sites (#7275). - BrowserPane: drop the pointerEvents assignment already applied inside `ensureBrowserPageWebview` for the reused-webview path (#6958). - github slice: fix two garbled "…a commit main confirmed…" comments (#7277). - runtime-file-client: trim the binary-file fallback comment to its whys (#6606). - composer-branch-selection: drop the inline comment that restated the JSDoc (#6748). - TabBarQuickCommandsButton: correct the stale "+ Command" comment (button shows no +). No behavior change (the editor-helper reuse is behavior-equivalent, only more conservative on an edge case); typecheck, oxlint, react-doctor, oxfmt, and touched unit suites all pass.
* Keep markdown TOC open per document * Clean up Markdown visibility state for replaced previews
…fix garbled comments (stablyai#7322) Quality pass on renderer/shared PRs merged 2026-07-03: - WorktreeTitleInlineRename: skip the truncation measure + ResizeObserver in `wrapTitle` mode, where wrapped titles never truncate — it could only churn unused state (stablyai#7307). - editor slice: reuse the `removeEditorStateForReplacedPreview` helper this PR added instead of a hand-rolled copy of the same six-field eviction (drops ~50 lines) (stablyai#6476). - useFileExplorerTree: extract `readWorktreeDirectory` so the connectionId/settings assembly for `readRuntimeDirectory` lives in one place, not three (stablyai#6321). - comment-markdown-github-attachment-media: extract a shared `AttachmentFallbackLink` for the image/video error-fallback link (stablyai#6759). - repository-icon-github: fold the two near-identical live resolvers into one parameterized `resolveRepositoryIdentityLive`; trim a 3-line comment to 2 (stablyai#6507). - resource-usage-open-slices: delete the `shouldReadPopoverSlices` identity wrapper and inline `open` at the four call sites (stablyai#7275). - BrowserPane: drop the pointerEvents assignment already applied inside `ensureBrowserPageWebview` for the reused-webview path (stablyai#6958). - github slice: fix two garbled "…a commit main confirmed…" comments (stablyai#7277). - runtime-file-client: trim the binary-file fallback comment to its whys (stablyai#6606). - composer-branch-selection: drop the inline comment that restated the JSDoc (stablyai#6748). - TabBarQuickCommandsButton: correct the stale "+ Command" comment (button shows no +). No behavior change (the editor-helper reuse is behavior-equivalent, only more conservative on an edge case); typecheck, oxlint, react-doctor, oxfmt, and touched unit suites all pass.
Summary
Screenshots
No visual layout change. This changes state retention behavior for the existing Table of Contents panel.
Testing
pnpm lintpnpm typecheckpnpm testwindow.localStoragetest-environment issues in:src/renderer/src/components/right-sidebar/pr-comment-presentation.test.tssrc/renderer/src/components/right-sidebar/pr-comments-list-selection.test.tsxsrc/renderer/src/components/sidebar/LinearAgentSkillSetupPrompt.reminder-toast.test.tsxsrc/renderer/src/components/sidebar/SidebarToolbar.test.tsxpnpm buildAdditional focused test:
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/store/slices/editor.test.tsAI Review Report
Codex and Claude reviewed the change for PR scope, state ownership, cleanup behavior, and regression coverage.
Claude found no blocking issues. It flagged a no-op cleanup reference-equality concern and a missing preview-replacement test; both were addressed. The review also checked cross-platform compatibility for macOS, Linux, and Windows: this change is renderer store/UI state only and does not touch shortcuts, labels, file paths, shell behavior, IPC, Electron platform branches, or provider-specific behavior.
Security Audit
No input handling, command execution, path handling, auth, secrets, dependencies, IPC, or network behavior changed. The new state is renderer-local UI state keyed by existing editor file ids.
A secrets pass over added code lines found no concerning credentials, tokens, private keys, or infrastructure identifiers.
Notes
This intentionally persists TOC visibility only while the relevant editor/preview tabs remain open. It does not add workspace-session or restart persistence.
X/Twitter handle: not included.