Skip to content

fix: make file browser selection stateless and add browser regression coverage#2

Open
tacogips wants to merge 1 commit into
mainfrom
fix/file-browser-keyboard-stateless-selection
Open

fix: make file browser selection stateless and add browser regression coverage#2
tacogips wants to merge 1 commit into
mainfrom
fix/file-browser-keyboard-stateless-selection

Conversation

@tacogips

Copy link
Copy Markdown
Owner

Summary

  • make the file browser directory API stateless so the frontend owns row selection and the backend only returns sorted, paginated snapshots
  • update the workspace and file browser panes around frontend-owned selection, keyboard navigation, and focus handling
  • add a browser harness route plus Playwright coverage for h/j/k/l navigation, using a Nix-friendly Chromium/Vite configuration

Verification

  • bun run typecheck
  • bun test
  • bunx playwright test e2e/file-browser-keyboard.pw.ts
  • CARGO_TERM_QUIET=true cargo check -p chilla
  • CARGO_TERM_QUIET=true cargo test -p chilla

… coverage

1. Primary Changes and Intent:
   Refactor the file browser so the frontend owns row selection while the Tauri backend returns stateless, sorted, paginated directory snapshots; add browser-level regression coverage for h/j/k/l navigation and the file-browser harness needed to reproduce focus behavior outside Tauri.

2. Key Technical Concepts:
   - Stateless Tauri directory listing contracts
   - Frontend-owned selected path and absolute selected index
   - Server-side sorting with offset/limit paging
   - Browser keyboard/focus regression testing with Playwright
   - Lazy app entry loading to avoid importing Tauri-only modules in browser harness mode

3. Files and Code Sections:
   - src-tauri/src/viewer/service.rs, src-tauri/src/viewer/types.rs, src-tauri/src/commands/document.rs, src/lib/tauri/document.ts: remove backend-owned selection fields from the directory API and keep list responses page-oriented
   - src/features/workspace/WorkspaceShell.tsx, src/features/file-view/FileBrowserPane.tsx: move selection ownership to the frontend and update keyboard/focus handling around list navigation
   - src/features/file-view/FileBrowserHarness.tsx, e2e/file-browser-keyboard.pw.ts, playwright.config.ts, src/app/App.tsx: add a browser harness route and end-to-end coverage for file-tree keyboard behavior on this Nix environment
   - src/features/file-view/sort.ts, src/features/file-view/sort.test.ts, src/features/preview/PreviewPane.tsx, src/app/App.css, README.md, flake.nix, package.json, bun.lock, src-tauri/Cargo.toml, impl-plans/active/file-viewer-mode.md: supporting updates for sorting, preview behavior, tooling, dependencies, and plan/docs

4. Problem Solving:
   Remove the dual source of truth between frontend and backend selection state, make the browser harness mount without importing Tauri window APIs, and make Playwright use the system Chromium plus a Bun/Vite startup configuration that works in this repository's Nix setup.

5. Impact:
   The file tree API is simpler, the frontend can reason about selection without backend echo state, and the repository now has repeatable browser coverage for keyboard navigation and focus behavior.

6. Unresolved TODOs:
   - [ ] None
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.

1 participant