Skip to content

feat(desktop): persist show hidden files setting per-project#1223

Merged
Kitenite merged 2 commits into
superset-sh:mainfrom
de1mat:feat/persist-hidden-files-setting
Feb 6, 2026
Merged

feat(desktop): persist show hidden files setting per-project#1223
Kitenite merged 2 commits into
superset-sh:mainfrom
de1mat:feat/persist-hidden-files-setting

Conversation

@de1mat
Copy link
Copy Markdown
Contributor

@de1mat de1mat commented Feb 5, 2026

Fixes #1232

Summary

Persists the "Show Hidden Files" setting per-project, so each project remembers its own preference across app restarts.

Changes:

  • Convert showHiddenFiles from boolean to Record<string, boolean> keyed by project.id
  • Add Zustand migration for users with legacy boolean value in localStorage
  • Setting shared across all worktrees of the same project (not per-worktree)

Test plan

  1. Toggle "Show Hidden Files" in a project
  2. Switch to a different project - should have its own independent setting
  3. Restart the app - settings should persist
  4. Switch between worktrees of the same project - setting should be shared

Summary by CodeRabbit

  • New Features
    • Hidden files visibility is now scoped per project, allowing users to independently control hidden file display settings for each project instead of applying a global setting across all projects.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

File-explorer's showHiddenFiles became project-scoped (Record<string, boolean>) with a legacy key for migration. FilesView now reads per-project value, keeps a synchronous ref for loaders, calls toggleHiddenFiles(projectId), and invalidates/refetches directories when toggling.

Changes

Cohort / File(s) Summary
FilesView component
apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/FilesView.tsx
Reads per-project showHiddenFiles (fallback to legacy), replaces local/global reads with showHiddenFilesRef for synchronous loader usage, updates handleToggleHiddenFiles(projectId) to toggle per-project setting and invalidate root/expanded directories; hook deps include projectId.
File explorer store & persistence
apps/desktop/src/renderer/stores/file-explorer.ts
showHiddenFiles changed from booleanRecord<string, boolean>; added LEGACY_SHOW_HIDDEN_KEY; updated toggleHiddenFiles to accept projectId; initial state and persistence/migration updated to preserve legacy boolean under the legacy key.

Sequence Diagram(s)

sequenceDiagram
  participant UI as FilesView (UI)
  participant Store as FileExplorerStore
  participant Loader as QueryClient/Loader
  participant Cache as ExpandedTreeCache

  UI->>Store: select showHiddenFiles(projectId) (fallback legacy)
  Store-->>UI: per-project showHiddenFiles
  UI->>UI: set showHiddenFilesRef.current
  UI->>Store: toggleHiddenFiles(projectId)
  Store-->>UI: updated per-project showHiddenFiles
  UI->>Cache: get expanded directories
  UI->>Loader: invalidate queries (root + expanded dirs)
  Loader-->>UI: refetch entries (includeHidden = showHiddenFilesRef.current)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I nibbled code in moonlit night,
Scoped burrows hidden out of sight.
A legacy key tucked in my paw,
Toggles hop and trees redraw —
Happy hops, hidden files in light! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main feature change: persisting the show hidden files setting on a per-project basis.
Description check ✅ Passed The PR description comprehensively covers all required template sections: clear summary, related issue, type of change, testing plan, and additional context.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/FilesView.tsx`:
- Line 18: Update the selector inside useFileExplorerStore that reads
showHiddenFiles for a given projectId so that when showHiddenFiles[projectId] is
undefined it falls back to the migrated legacy default (e.g.,
legacyShowHiddenDefault) instead of treating it as false; locate the
selector/getter referencing showHiddenFiles and projectId and change the
conditional to use (showHiddenFiles?.[projectId] ?? LEGACY_SHOW_HIDDEN_DEFAULT).
Also extract any hardcoded magic strings/numbers used in that logic (like the
legacy default key/name and default boolean) into named constants at the top of
the module to replace inline literals.

In `@apps/desktop/src/renderer/stores/file-explorer.ts`:
- Around line 142-149: Existing migration drops legacy boolean hidden-files
preference and toggleHiddenFiles assumes missing key => false; update the
migration logic that transforms persisted state (migrate function) to copy any
legacy boolean (e.g., a top-level showHiddenFiles boolean) into the new
showHiddenFiles map under a named DEFAULT_PROJECT_KEY constant, and modify
toggleHiddenFiles(projectId) to fall back to get().showHiddenFiles[projectId] ??
get().showHiddenFiles[DEFAULT_PROJECT_KEY] ?? false so migrated users keep their
setting; also extract hardcoded strings/numbers (like the default project key
name and any version number constants used in migrate) into named constants at
the module top and use those constants in both the migrate routine and
toggleHiddenFiles.

Comment thread apps/desktop/src/renderer/stores/file-explorer.ts
- Change showHiddenFiles from boolean to Record<string, boolean>
  keyed by project.id so each project remembers its own setting
- Add migration for users with legacy boolean in localStorage
- Preserve legacy value under LEGACY_SHOW_HIDDEN_KEY so users
  don't lose their preference when upgrading
- Setting persists across app restarts via Zustand persist middleware
@de1mat de1mat force-pushed the feat/persist-hidden-files-setting branch from a77032c to 33ae3b7 Compare February 5, 2026 09:23
@Kitenite Kitenite merged commit 1e71ac4 into superset-sh:main Feb 6, 2026
2 of 5 checks passed
@Kitenite
Copy link
Copy Markdown
Collaborator

Kitenite commented Feb 6, 2026

Removed the migration and legacy key since i think it's minor enough. Thanks @de1mat!

@de1mat
Copy link
Copy Markdown
Contributor Author

de1mat commented Feb 6, 2026

Removed the migration and legacy key since i think it's minor enough. Thanks @de1mat!

Pleasure! Funny, I only added the legacy key because CodeRabbit told me to 🤣 Looks cleaner without it 👍

@Kitenite
Copy link
Copy Markdown
Collaborator

Kitenite commented Feb 6, 2026

No worries it's a good measure if this was a more important config

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.

[feat] Persist show hidden files setting per-project

2 participants