Skip to content

feat(workspace): add single item viewer - #1777

Merged
zerob13 merged 1 commit into
devfrom
feat/workspace-single-item-viewer
Jun 17, 2026
Merged

feat(workspace): add single item viewer#1777
zerob13 merged 1 commit into
devfrom
feat/workspace-single-item-viewer

Conversation

@zhangmo8

@zhangmo8 zhangmo8 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator
cbc8669c26569ae1ddd7e894dfecdb9e

Summary

  • switch workspace file and git diff selections into a single-item viewer flow with a back button
  • keep artifact selections in list mode
  • avoid flashing the initial file loading state when reopening with a cached file tree
  • tolerate workspace watcher startup failures without blocking the file list

Tests

  • pnpm run format
  • pnpm run i18n
  • pnpm run lint
  • pnpm run typecheck:web
  • pnpm vitest run test/renderer/components/WorkspacePanel.test.ts test/renderer/components/WorkspaceViewer.test.ts
  • commit hook typecheck

Summary by CodeRabbit

  • New Features

    • Workspace single-file viewer mode: selecting a file or Git change displays that item in a focused view with a back button to return to the full workspace list.
  • Bug Fixes

    • Reduced unnecessary loading flashes when refreshing workspace file trees in the background.
  • Tests

    • Added comprehensive test coverage for new single-file viewer navigation behavior.

@zerob13
zerob13 merged commit 5968814 into dev Jun 17, 2026
2 checks passed
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc0db09c-3ac5-4ba2-886b-f10f8646c408

📥 Commits

Reviewing files that changed from the base of the PR and between ce6796e and e92ea0f.

📒 Files selected for processing (8)
  • docs/features/workspace-single-file-viewer/plan.md
  • docs/features/workspace-single-file-viewer/spec.md
  • docs/features/workspace-single-file-viewer/tasks.md
  • src/renderer/src/components/sidepanel/WorkspacePanel.vue
  • src/renderer/src/components/sidepanel/WorkspaceViewer.vue
  • src/renderer/src/components/sidepanel/composables/useWorkspaceSync.ts
  • test/renderer/components/WorkspacePanel.test.ts
  • test/renderer/components/WorkspaceViewer.test.ts

📝 Walkthrough

Walkthrough

Implements a workspace single-file viewer mode: selecting a file or Git diff in the side panel now replaces the navigation list with a focused WorkspaceViewer (with a back button to return to the list), while artifact selections keep the list visible. Section toggling moves from local state to the sidepanel store. useWorkspaceSync gains background-refresh loading suppression and a watcher error guard. Feature spec, plan, and tasks docs are added alongside tests.

Changes

Workspace Single-File Viewer

Layer / File(s) Summary
Feature spec, plan, and tasks
docs/features/workspace-single-file-viewer/spec.md, docs/features/workspace-single-file-viewer/plan.md, docs/features/workspace-single-file-viewer/tasks.md
Spec defines acceptance criteria and non-goals; plan describes the implementation approach and affected components; tasks checklist records completed work.
WorkspaceViewer back button prop and event
src/renderer/src/components/sidepanel/WorkspaceViewer.vue
Adds optional showBackButton prop and back emitted event; conditionally renders a ghost icon button in the header that emits back on click.
WorkspacePanel single-item mode and store-driven section toggling
src/renderer/src/components/sidepanel/WorkspacePanel.vue
Introduces isSingleItemViewerActive/isWorkspaceViewerVisible computed flags and handleViewerBack; hides the navigation list when a file or diff is selected; rewires all section toggle buttons to sidepanelStore.toggleSection; removes local navCollapsed/resize logic and WorkspaceNavSection import.
useWorkspaceSync background loading and watcher error guard
src/renderer/src/components/sidepanel/composables/useWorkspaceSync.ts
Adds shouldShowInitialLoading to suppress loadingFiles flash on background/git refreshes when a cached tree exists; wraps watchWorkspace in try/catch to log a warning and continue on failure.
WorkspacePanel and WorkspaceViewer tests
test/renderer/components/WorkspacePanel.test.ts, test/renderer/components/WorkspaceViewer.test.ts
Converts test state to Vue reactive; updates stubs for back emit; adds tests for file/diff viewer switching and back navigation, artifact list-visible behavior, background-refresh with fake timers, and the back button in WorkspaceViewer.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ThinkInAIXYZ/deepchat#1352: Shares the useWorkspaceSync.ts workspace invalidation and watcher lifecycle path that this PR builds on for background refresh behavior.
  • ThinkInAIXYZ/deepchat#1718: Directly modifies WorkspaceViewer.vue's diff-display code paths, overlapping with the back button and viewer header changes here.
  • ThinkInAIXYZ/deepchat#1720: Modifies WorkspacePanel.vue's section-expansion and collapse logic, the same area this PR rewires to use sidepanelStore.toggleSection.

Poem

🐇 Hop! A single file takes the stage,
The list steps back, a viewer fills the page.
One click returns you, back control in place,
No loading flash — the cache saves face.
I've tunneled through the Vue with cheer,
The workspace single-file viewer is here! 🌿

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/workspace-single-item-viewer

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zhangmo8
zhangmo8 deleted the feat/workspace-single-item-viewer branch June 17, 2026 08:49
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.

2 participants