Skip to content

feat(desktop): add configurable file tree hiding - #6326

Closed
RA1NCS wants to merge 6 commits into
ParadevAI:mainfrom
RA1NCS:feat/file-tree-hidden-patterns
Closed

RA1NCS wants to merge 6 commits into
ParadevAI:mainfrom
RA1NCS:feat/file-tree-hidden-patterns

Conversation

@RA1NCS

@RA1NCS RA1NCS commented Aug 10, 2026 •

Copy link
Copy Markdown

Summary

  • add a Settings > Appearance list of gitignore-flavored patterns hidden from the v2 workspace file tree
  • default to .git, node_modules, and .DS_Store
  • apply filtering to initial directory loads, refreshes, live creates, and renames
  • reload the current tree immediately when patterns change

Closes the current request tracked in #5595 and revives the still-applicable behavior from #3153.

Validation

  • bun test src/shared/file-tree-patterns.test.ts src/renderer/routes/_authenticated/settings/utils/settings-search/
    • 22 passed, 0 failed
  • bunx turbo typecheck --filter=@superset/desktop --filter=@superset/local-db
  • Biome check on all changed source files
  • manually verified on macOS Desktop v1.20.2 against a repository containing dot-directories, caches, nested generated folders, and live file-system changes

Manual behavior verified

  • defaults hide .git, node_modules, and .DS_Store
  • adding/removing patterns updates the open Files sidebar
  • anchored /output, directory-only build/, basename, *, ?, and ** patterns behave as documented
  • Reset to defaults restores the shipped list
  • terminal and file operations remain unaffected

Summary by cubic

Adds configurable hidden-file patterns to Desktop file trees, applied to both the v2 workspace tree and the legacy Files explorer. Patterns are persisted, loaded before first render, and used to filter loads, refreshes, live events, and search results.

  • New Features

    • New Settings > Appearance “Hidden files” textarea with Save/Reset; searchable; editing/save/reset are disabled while saving or until patterns load; load failures show a Retry; oversized patterns are rejected with an error.
    • Defaults to .git, node_modules, and .DS_Store; every loaded directory reloads immediately when patterns change; initial load waits for persisted patterns.
    • Filtering covers v2 Files tab and the legacy Files explorer: refresh and live create/rename are filtered (events under hidden ancestors are ignored; renames into hidden drop the entry); search results are filtered; legacy caches invalidate on changes.
    • Glob support: *, ?, **, leading / to anchor to root, trailing / for directories, and basename matches without /.
    • TRPC: getFileTreeHiddenPatterns and setFileTreeHiddenPatterns with input limits; saves are blocked if the pattern list hasn’t loaded.
    • Matcher with unit tests; matches ancestors per path segment derived from the relative path; normalizes Windows separators.
  • Migration

    • Adds settings.file_tree_hidden_patterns column in @superset/local-db; applies via existing migrations, no manual steps.

Written for commit 69105e1. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added configurable hidden-file patterns for the workspace file tree.
    • Added a “Hidden Files” section in Appearance settings with editing, saving, reset, search highlighting, and guidance.
    • Supports glob-style patterns for hiding files and folders, including wildcards, directory matching, comments, and rooted paths.
    • Hidden entries are also excluded from file search results.
  • Bug Fixes

    • Hidden files and directories remain filtered during refreshes, creation, and renames.
  • Tests

    • Added coverage for pattern matching, path formats, wildcards, comments, and invalid patterns.

- add Settings > Appearance "Hidden files" pattern list, persisted per install
- filter listings, refreshes and fs:events in the v2 FilesTab bridge
- default to .git, node_modules and .DS_Store
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The desktop app supports configurable hidden file-tree patterns. Patterns are stored in local settings, edited in Appearance settings, and applied to workspace listings, search results, and filesystem events.

Changes

File-tree hidden patterns

Layer / File(s) Summary
Pattern matching contract and validation
apps/desktop/src/shared/file-tree-patterns.ts, apps/desktop/src/shared/file-tree-patterns.test.ts
Adds gitignore-style glob matching, pattern limits, path normalization, directory-only rules, and matcher tests.
Settings storage and router API
packages/local-db/drizzle/0046_add_file_tree_hidden_patterns.sql, packages/local-db/drizzle/meta/*, packages/local-db/src/schema/schema.ts, apps/desktop/src/lib/trpc/routers/settings/index.ts
Stores hidden patterns in the settings table. Adds queries and mutations that apply defaults, trimming, empty-value removal, and validation.
Appearance settings editor
apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/*, apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.ts
Adds the v2 Hidden Files setting with editable patterns, save and reset actions, cache invalidation, guidance, and search registration.
Workspace file-tree filtering
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/*, apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/FilesView.tsx
Loads hidden patterns and filters directory listings, search results, refreshes, create events, and renames into hidden paths.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FileTreeHiddenSection
  participant SettingsRouter
  participant LocalSettings
  participant FilesView
  participant useFilesTabBridge

  User->>FileTreeHiddenSection: edit and save patterns
  FileTreeHiddenSection->>SettingsRouter: setFileTreeHiddenPatterns
  SettingsRouter->>LocalSettings: persist patterns
  FilesView->>SettingsRouter: getFileTreeHiddenPatterns
  SettingsRouter-->>FilesView: return patterns
  FilesView->>FilesView: filter listings and search results
  useFilesTabBridge->>useFilesTabBridge: filter workspace events and listings
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title uses conventional commit format and clearly describes the configurable file-tree hiding feature.
Description check ✅ Passed The description explains the change, testing, manual verification, affected behavior, persistence, and migration details.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/hooks/useFilesTabBridge/useFilesTabBridge.ts (1)

388-396: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Create events for descendants of a hidden directory are not filtered.

isHidden tests only the entry's own path. It does not test ancestors. createFileTreeHiddenMatcher compares a slash-containing pattern against the entry's own relativePath, and a basename pattern against the entry's own name.

The initial-load path is safe because fetchDir never lists children of a directory it filtered out. The create event path is not safe, because the watcher reports each new path directly.

Example with the default pattern node_modules:

  1. node_modules/ is filtered at Line 390 and never enters knownPaths.
  2. An install writes node_modules/lodash/index.js.
  3. isHidden("node_modules/lodash/index.js", false) returns false.
  4. addKnownPath adds the file. Pierre receives a path whose parent it does not know.

The result is either hidden content that reappears in the tree, or a rejected model.add that the catch at Line 451 swallows, which leaves knownPaths out of sync with the model. Package installs and build output make this reachable in normal use.

Test each ancestor directory as well as the entry itself.

🐛 Proposed fix: test ancestors in `isHidden`
 	const isHidden = useCallback(
-		(rel: string, isDirectory: boolean) =>
-			matcher({
-				name: rel.split("/").pop() ?? "",
-				relativePath: rel,
-				isDirectory,
-			}),
+		(rel: string, isDirectory: boolean) => {
+			const segments = rel.split("/");
+			// Test the entry itself, then every ancestor directory: a create
+			// event can arrive for a descendant of a directory we filtered out.
+			for (let depth = segments.length; depth > 0; depth -= 1) {
+				const candidate = segments.slice(0, depth).join("/");
+				const candidateIsDirectory =
+					depth < segments.length ? true : isDirectory;
+				if (
+					matcher({
+						name: segments[depth - 1] ?? "",
+						relativePath: candidate,
+						isDirectory: candidateIsDirectory,
+					})
+				) {
+					return true;
+				}
+			}
+			return false;
+		},
 		[matcher],
 	);

Add a test in apps/desktop/src/shared/file-tree-patterns.test.ts or a bridge-level test that asserts a descendant of a hidden directory stays hidden. Do you want me to open an issue to track this?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/components/FilesTab/hooks/useFilesTabBridge/useFilesTabBridge.ts
around lines 388 - 396, Update the create-event handling in useFilesTabBridge so
hidden status is evaluated for the entry and every ancestor directory before
calling addKnownPath or updating unloadedDirCandidatesRef. Reuse or extend
isHidden/createFileTreeHiddenMatcher to walk ancestor paths, ensuring
descendants such as node_modules/lodash/index.js remain filtered; add a
regression test in the existing file-tree-patterns or bridge tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx`:
- Around line 30-35: Update FileTreeHiddenSection so the textarea no longer
persists through onBlur={commit}; rely on the button actions as the single
persistence path. Disable both action buttons while setPatterns.isPending to
prevent overlapping mutations, and add a regression test covering editing the
textarea followed by clicking Reset, ensuring only the reset/default patterns
are persisted.

---

Outside diff comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/components/WorkspaceSidebar/components/FilesTab/hooks/useFilesTabBridge/useFilesTabBridge.ts:
- Around line 388-396: Update the create-event handling in useFilesTabBridge so
hidden status is evaluated for the entry and every ancestor directory before
calling addKnownPath or updating unloadedDirCandidatesRef. Reuse or extend
isHidden/createFileTreeHiddenMatcher to walk ancestor paths, ensuring
descendants such as node_modules/lodash/index.js remain filtered; add a
regression test in the existing file-tree-patterns or bridge tests.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 35bc8980-cae9-4309-9274-383cd0d17eb4

📥 Commits

Reviewing files that changed from the base of the PR and between a42ebfe and de7136e.

📒 Files selected for processing (13)
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/FilesTab.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/hooks/useFilesTabBridge/useFilesTabBridge.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/AppearanceSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/index.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.ts
  • apps/desktop/src/shared/file-tree-patterns.test.ts
  • apps/desktop/src/shared/file-tree-patterns.ts
  • packages/local-db/drizzle/0046_add_file_tree_hidden_patterns.sql
  • packages/local-db/drizzle/meta/0046_snapshot.json
  • packages/local-db/drizzle/meta/_journal.json
  • packages/local-db/src/schema/schema.ts

- match ancestors so watcher events under hidden directories stay hidden
- wait for persisted patterns before the initial tree load
- surface pattern validation failures to the user

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

- filter lazy directory listings and search results in FilesView
- invalidate legacy tree caches when hidden patterns change

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/FilesView.tsx`:
- Around line 258-264: Update the hiddenMatcher effect in FilesView to
invalidate every currently expanded directory instead of only the root item.
Reuse refreshVisibleDirectories(), or extract and call a shared invalidation
helper, while preserving the existing cache clearing and filesystem search
invalidation.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 474a2ea1-5923-4056-b57d-310a1f1d1f93

📥 Commits

Reviewing files that changed from the base of the PR and between 064b9ea and 8e51582.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/FilesView.tsx

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

- drop conflicting blur auto-save and block edits during writes
- reject oversized patterns before the mutation with visible feedback
- keep the tree in a loading state until patterns resolve
- reload every loaded directory when patterns change
- build ancestor candidates without repeated slicing

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx`:
- Around line 84-101: Update FileTreeHiddenSection’s editor and Save/Reset
controls to remain disabled when the settings query is unavailable by including
isError || data === undefined alongside the existing loading checks. Add a
persistent load-error or retry state for that condition, while preserving normal
editing and saving when data is available.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fa7c72ee-7053-4d94-bd08-baa558b9f7ad

📥 Commits

Reviewing files that changed from the base of the PR and between 8e51582 and 74f6d13.

📒 Files selected for processing (4)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/FilesTab.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/FilesView.tsx
  • apps/desktop/src/shared/file-tree-patterns.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/desktop/src/shared/file-tree-patterns.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/FilesTab.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/FilesView/FilesView.tsx

Shreyan Gupta added 2 commits August 10, 2026 14:28
- block editing, save and reset while the pattern query has no data
- surface a load failure with a retry action
- drop the redundant name field now that ancestors are matched per segment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx`:
- Around line 92-104: Add the `select-text cursor-text` classes to the
error-message span in `FileTreeHiddenSection`, preserving the existing styling
and retry button behavior.
- Around line 87-90: Update the mutation success flow associated with the editor
around setPatterns so it returns or awaits the query invalidate operation before
completing, keeping the editor disabled until refetch finishes. Add a regression
test that verifies edits made during the delayed refetch are not cleared by the
persisted-state effect.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 23c2f1e9-5721-49db-ac57-fc194c441aac

📥 Commits

Reviewing files that changed from the base of the PR and between 74f6d13 and 69105e1.

📒 Files selected for processing (4)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/hooks/useFilesTabBridge/useFilesTabBridge.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx
  • apps/desktop/src/shared/file-tree-patterns.test.ts
  • apps/desktop/src/shared/file-tree-patterns.ts
💤 Files with no reviewable changes (1)
  • apps/desktop/src/shared/file-tree-patterns.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/desktop/src/shared/file-tree-patterns.test.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/hooks/useFilesTabBridge/useFilesTabBridge.ts

Comment on lines +87 to +90
disabled={isUnavailable || setPatterns.isPending}
value={value}
onChange={(event) => setDraft(event.target.value)}
/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

file=$(fd -t f 'FileTreeHiddenSection\.tsx$' . | head -n 1)

rg -n -C 8 \
  'onSuccess|invalidate|isPending|useEffect|persisted|setDraft' \
  "$file"

if rg -q \
  'void utils\.settings\.getFileTreeHiddenPatterns\.invalidate\(\)' \
  "$file"; then
  echo "FAIL: invalidation is not awaited or returned"
  exit 1
fi

echo "PASS: invalidation is not explicitly discarded"

Repository: superset-sh/superset

Length of output: 3455


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

file=$(fd -t f 'FileTreeHiddenSection\.tsx$' . | head -n 1)
printf '%s\n' "== component =="
cat -n "$file"

printf '%s\n' "== related tests and mutation/query definitions =="
rg -n -C 6 \
  'FileTreeHiddenSection|setFileTreeHiddenPatterns|getFileTreeHiddenPatterns|createTRPC|invalidate\(' \
  apps/desktop --glob '*.{ts,tsx}' --glob '*.{test,spec}.{ts,tsx}' \
  | head -n 500

Repository: superset-sh/superset

Length of output: 50376


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

needle = "FileTreeHiddenSection"
for p in Path(".").rglob("*"):
    if p.is_file() and any(part in {"node_modules", ".git", "dist", "build"} for part in p.parts):
        continue
    try:
        text = p.read_text()
    except (UnicodeDecodeError, OSError):
        continue
    if needle in text and p.name != "FileTreeHiddenSection.tsx":
        print(p)
PY

Repository: superset-sh/superset

Length of output: 419


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' "== settings router =="
cat -n apps/desktop/src/lib/trpc/routers/settings/index.ts | sed -n '940,990p'

printf '%s\n' "== query provider and dependency versions =="
rg -n -C 8 \
  'QueryClient|ElectronTRPCProvider|`@tanstack/react-query`|`@trpc/react-query`|trpc-electron' \
  apps/desktop/src/renderer/providers apps/desktop/package.json package.json bun.lock \
  --glob '*.{ts,tsx,json,yaml,yml}' \
  | head -n 300

printf '%s\n' "== component test files =="
fd -t f -i 'FileTreeHiddenSection|AppearanceSettings' apps/desktop | sort

Repository: superset-sh/superset

Length of output: 24757


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
# Read-only state-machine probe for the sequence described by the component:
# mutation success -> invalidation/refetch starts -> editor becomes enabled ->
# user edits -> refetch changes persisted -> effect clears draft.
persisted = "old\npattern"
draft = "new\npattern"
events = []

events.append(("mutation success", persisted, draft))
events.append(("onSuccess returns immediately", persisted, draft))
draft = "new\npattern\nuser-edit"
events.append(("user edits while refetch is pending", persisted, draft))
persisted = "new\npattern"
draft = None  # useEffect([persisted]) behavior
events.append(("refetch updates persisted; effect clears draft", persisted, draft))

for event, current_persisted, current_draft in events:
    print(f"{event}: persisted={current_persisted!r}, draft={current_draft!r}")

if events[-1][2] is None:
    print("FAIL: the user edit is discarded by the persisted-change effect")
    raise SystemExit(1)
PY

Repository: superset-sh/superset

Length of output: 545


Await invalidation before re-enabling the editor.

onSuccess discards invalidate(), but the editor only checks setPatterns.isPending. A user edit can occur before the refetch completes, and the persisted effect can then clear that edit. Return or await invalidate() and add a delayed-refetch regression test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx`
around lines 87 - 90, Update the mutation success flow associated with the
editor around setPatterns so it returns or awaits the query invalidate operation
before completing, keeping the editor disabled until refetch finishes. Add a
regression test that verifies edits made during the delayed refetch are not
cleared by the persisted-state effect.

Source: MCP tools

Comment on lines +92 to +104
{isError && (
<div className="mt-2 flex items-center gap-2 text-xs text-destructive">
<span>Could not load hidden file patterns.</span>
<Button
variant="outline"
size="sm"
className="h-7 text-xs"
onClick={() => void refetch()}
>
Retry
</Button>
</div>
)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the load error message selectable.

Add select-text cursor-text to the <span> that renders the error.

Proposed fix
-					<span>Could not load hidden file patterns.</span>
+					<span className="select-text cursor-text">
+						Could not load hidden file patterns.
+					</span>

As per coding guidelines, rendered error messages in apps/desktop/src/renderer/**/*.{tsx,css,scss} must include select-text cursor-text classes.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{isError && (
<div className="mt-2 flex items-center gap-2 text-xs text-destructive">
<span>Could not load hidden file patterns.</span>
<Button
variant="outline"
size="sm"
className="h-7 text-xs"
onClick={() => void refetch()}
>
Retry
</Button>
</div>
)}
{isError && (
<div className="mt-2 flex items-center gap-2 text-xs text-destructive">
<span className="select-text cursor-text">
Could not load hidden file patterns.
</span>
<Button
variant="outline"
size="sm"
className="h-7 text-xs"
onClick={() => void refetch()}
>
Retry
</Button>
</div>
)}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx`
around lines 92 - 104, Add the `select-text cursor-text` classes to the
error-message span in `FileTreeHiddenSection`, preserving the existing styling
and retry button behavior.

Source: Coding guidelines

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx">

<violation number="1" location="apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx:34">
P3: isUnavailable is true whenever isError is true, not just when data is unknown. After a first successful load, a later background refetch that fails (e.g. on window focus/invalidate) leaves the cached data in place while isError flips to true, so the textarea, Save, and Reset all become disabled and an error banner appears even though the current patterns are known and displayed. The stated intent is only to guard against an unknown list (data === undefined); consider disabling on data === undefined || (isError && data === undefined), or tracking the error only when there is no cached value.</violation>

<violation number="2" location="apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx:94">
P3: The newly added error message span doesn't include `select-text cursor-text` classes, which per repo convention for rendered error messages in this renderer directory should be selectable by users for easier copy/paste when reporting issues.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

electronTrpc.settings.getFileTreeHiddenPatterns.useQuery();
// Never edit against an unknown list: saving an empty fallback would wipe
// the stored patterns.
const isUnavailable = isError || data === undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: isUnavailable is true whenever isError is true, not just when data is unknown. After a first successful load, a later background refetch that fails (e.g. on window focus/invalidate) leaves the cached data in place while isError flips to true, so the textarea, Save, and Reset all become disabled and an error banner appears even though the current patterns are known and displayed. The stated intent is only to guard against an unknown list (data === undefined); consider disabling on data === undefined || (isError && data === undefined), or tracking the error only when there is no cached value.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx, line 34:

<comment>isUnavailable is true whenever isError is true, not just when data is unknown. After a first successful load, a later background refetch that fails (e.g. on window focus/invalidate) leaves the cached data in place while isError flips to true, so the textarea, Save, and Reset all become disabled and an error banner appears even though the current patterns are known and displayed. The stated intent is only to guard against an unknown list (data === undefined); consider disabling on data === undefined || (isError && data === undefined), or tracking the error only when there is no cached value.</comment>

<file context>
@@ -27,8 +27,11 @@ function toPatterns(text: string): string[] {
 		electronTrpc.settings.getFileTreeHiddenPatterns.useQuery();
+	// Never edit against an unknown list: saving an empty fallback would wipe
+	// the stored patterns.
+	const isUnavailable = isError || data === undefined;
 	const setPatterns =
 		electronTrpc.settings.setFileTreeHiddenPatterns.useMutation({
</file context>


{isError && (
<div className="mt-2 flex items-center gap-2 text-xs text-destructive">
<span>Could not load hidden file patterns.</span>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The newly added error message span doesn't include select-text cursor-text classes, which per repo convention for rendered error messages in this renderer directory should be selectable by users for easier copy/paste when reporting issues.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/desktop/src/renderer/routes/_authenticated/settings/appearance/components/AppearanceSettings/components/FileTreeHiddenSection/FileTreeHiddenSection.tsx, line 94:

<comment>The newly added error message span doesn't include `select-text cursor-text` classes, which per repo convention for rendered error messages in this renderer directory should be selectable by users for easier copy/paste when reporting issues.</comment>

<file context>
@@ -81,24 +84,38 @@ export function FileTreeHiddenSection() {
 
+			{isError && (
+				<div className="mt-2 flex items-center gap-2 text-xs text-destructive">
+					<span>Could not load hidden file patterns.</span>
+					<Button
+						variant="outline"
</file context>
Suggested change
<span>Could not load hidden file patterns.</span>
<span className="select-text cursor-text">
Could not load hidden file patterns.
</span>

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

This PR has had no activity for 53 days and will close in 7 days unless there is new activity. If this contribution is still important or relevant, please leave a comment to keep it open. If it closes, you are welcome to reopen it or ask a maintainer to reopen it. Thank you for contributing!

@github-actions github-actions Bot added the stale label Oct 3, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was automatically closed due to inactivity to help keep the review queue manageable. This does not mean the contribution was rejected. If this contribution is still important or relevant, please reopen it or leave a comment asking a maintainer to reopen it. Thank you for contributing!

@github-actions github-actions Bot closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant