Skip to content

fix(tauri): opaque overlays and menus on transparent window - #3076

Open
gprot42 wants to merge 1 commit into
spacedriveapp:mainfrom
gprot42:fix/tauri-transparent-window-ui
Open

fix(tauri): opaque overlays and menus on transparent window#3076
gprot42 wants to merge 1 commit into
spacedriveapp:mainfrom
gprot42:fix/tauri-transparent-window-ui

Conversation

@gprot42

@gprot42 gprot42 commented Jul 8, 2026

Copy link
Copy Markdown

Summary

  • Scan @spacedrive/primitives for Tailwind v4 so dialog/menu classes compile in the Tauri app
  • Force opaque dialog overlays and menu backgrounds on Tauri's transparent native window
  • Fix unreadable dropdowns and Add Storage category tiles bleeding through the shell

Test plan

  • Open Add Storage — all four category tiles readable
  • Open All Devices dropdown — options readable
  • Dialog overlays fully obscure content behind them

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@gprot42, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a5dc0df2-e532-4b83-bf64-c9bff622aead

📥 Commits

Reviewing files that changed from the base of the PR and between cda9429 and 78e09d8.

📒 Files selected for processing (1)
  • apps/tauri/src/index.css

Walkthrough

This PR adds explicit sort direction handling across explorer state, file queries, and directory sorting, and also updates the Tauri app with transparent-window styling plus browser and Vite compatibility stubs.

Changes

Tauri window and browser support

Layer / File(s) Summary
Tailwind source scanning
apps/tauri/src/index.css
Adds @source entries for @spacedrive/primitives and @spacedrive/ai, and adds transparent-window overlay styles for fixed layers, solid panel backgrounds, and menu readability.
Browser stubs
apps/tauri/src/stubs/debug.ts, apps/tauri/src/stubs/spacebot-api-client.ts
Adds a no-op debug stub and a stubbed @spacebot/api-client module with exported types, endpoint helpers, and default async responses.
Vite resolution
apps/tauri/vite.config.ts
Adds Bun-based CommonJS interop resolution, unconditional @spacebot/api-client aliasing, a debug alias, dependency optimization entries, and empty Rollup options.

Explorer sort direction

Layer / File(s) Summary
Directory sort contract
core/src/ops/files/query/directory_listing.rs, apps/cli/src/domains/file/mod.rs, core/tests/normalized_cache_fixtures_test.rs
Adds sort_direction to directory listing input, initializes it to None, updates indexed and in-memory sorting to honor explicit direction, and updates callers and fixtures.
Sort state and helpers
packages/interface/src/components/TabManager/TabManagerContext.tsx, packages/interface/src/routes/explorer/context.tsx, packages/interface/src/routes/explorer/sortUtils.ts
Adds explorer SortOrder state, default sort order handling, sort-direction conversion helpers, and client-side file sorting utilities.
Query wiring
packages/interface/src/routes/explorer/hooks/useExplorerFiles.ts, packages/interface/src/routes/explorer/hooks/useExplorerKeyboard.ts, packages/interface/src/routes/explorer/views/ColumnView/Column.tsx, packages/interface/src/routes/explorer/views/ColumnView/ColumnView.tsx, packages/interface/src/routes/explorer/views/KnowledgeView.tsx, packages/interface/src/routes/explorer/views/SizeView/SizeView.tsx
Passes explorer sort order into directory listing queries from the file hooks and column, knowledge, and size views.
Sort controls
packages/interface/src/routes/explorer/ExplorerView.tsx, packages/interface/src/routes/explorer/views/ListView/ListView.tsx
Updates explorer controls to use shared sort-change callbacks, adds the storage action, and changes list headers and indicators to reflect the new sort order state.

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

Poem

A rabbit twitched its whiskers, neat and keen,
For sort order now runs asc and green.
Overlays glow, stubs softly hum,
The menu stays clear where the arrows come.
Hop hop, the explorer sorts just right 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and directly reflects the main Tauri change to opaque overlays and menus on transparent windows.
Description check ✅ Passed The description covers Summary and Test plan, but it omits the template’s required Closes #(issue) line.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/tauri/src/index.css (1)

105-106: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Overridden selectors depend on specific utility class names — fragile.

The selectors .z-[103] .border-app-line.bg-app-box and .border-menu-line.bg-menu\/95 target elements by their Tailwind utility class names from @spacedrive/primitives. If the primitives library changes which utility classes it applies (e.g., switching from bg-menu/95 to bg-menu/90), these overrides will silently stop matching and the readability bugs will reappear.

Consider adding a brief comment noting which primitive component(s) these selectors target, so future maintainers can trace the dependency.

Also applies to: 113-116

🤖 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/tauri/src/index.css` around lines 105 - 106, The selector overrides in
index.css are tied to Tailwind utility classes from `@spacedrive/primitives`, so
add brief comments next to the affected rules to identify the primitive
component(s) they target. Use the existing selector groups like .z-[103]
.border-app-line.bg-app-box and .border-menu-line.bg-menu\/95 as anchors, and
document the dependency so future maintainers can trace and update these
overrides if the primitives’ class names change.
🤖 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.

Nitpick comments:
In `@apps/tauri/src/index.css`:
- Around line 105-106: The selector overrides in index.css are tied to Tailwind
utility classes from `@spacedrive/primitives`, so add brief comments next to the
affected rules to identify the primitive component(s) they target. Use the
existing selector groups like .z-[103] .border-app-line.bg-app-box and
.border-menu-line.bg-menu\/95 as anchors, and document the dependency so future
maintainers can trace and update these overrides if the primitives’ class names
change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2b873785-e715-489d-817a-55123daa78f4

📥 Commits

Reviewing files that changed from the base of the PR and between 60369e9 and e824b6b.

📒 Files selected for processing (1)
  • apps/tauri/src/index.css

@gprot42
gprot42 force-pushed the fix/tauri-transparent-window-ui branch from e824b6b to cda9429 Compare July 8, 2026 17:34

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Added 1 comment

Comment thread apps/tauri/src/index.css
*/
.fixed.inset-0.z-\[102\] {
z-index: 102 !important;
background-color: color-mix(in srgb, var(--color-app) 92%, transparent) !important;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[🟡 Medium] [🔵 Bug]

The Tauri overlay override still mixes var(--color-app) with transparent, producing a final background with alpha below 1; because the dialog overlay itself is also opacity-animated, content can continue to bleed through during and after the transition instead of being fully obscured. Use a fully opaque app background for the overlay (or otherwise remove the transparent component) so dialogs actually cover the transparent native window.

/* apps/tauri/src/index.css */
.fixed.inset-0.z-\[102\] {
	z-index: 102 !important;
	background-color: color-mix(in srgb, var(--color-app) 92%, transparent) !important;
	margin: 0 !important;
}
Suggested change
background-color: color-mix(in srgb, var(--color-app) 92%, transparent) !important;
background-color: var(--color-app) !important;

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (1)
packages/interface/src/routes/explorer/hooks/useExplorerKeyboard.ts (1)

49-56: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Missing folders_first in directory listing query.

The keyboard navigation query omits folders_first while every other directory listing query in this PR includes it (useExplorerFiles, ColumnView, KnowledgeView, SizeView). Since viewSettings is already destructured at Line 22, this appears to be an oversight. Without folders_first, the backend may return files in a different order than what's displayed, causing arrow-key navigation to jump to unexpected files.

🐛 Proposed fix
 				path: currentPath,
 				limit: null,
 				include_hidden: false,
 				sort_by: sortBy as DirectorySortBy,
 				sort_direction: toSortDirection(sortOrder),
+				folders_first: viewSettings.foldersFirst,
 			}
 			: null!,
🤖 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 `@packages/interface/src/routes/explorer/hooks/useExplorerKeyboard.ts` around
lines 49 - 56, The directory listing query in useExplorerKeyboard is missing
folders_first, which can cause keyboard navigation to use a different ordering
than the rest of the views. Update the input object built from currentPath to
include folders_first using the already destructured viewSettings, matching the
behavior in useExplorerFiles, ColumnView, KnowledgeView, and SizeView so
arrow-key navigation stays consistent with the displayed order.
🧹 Nitpick comments (4)
apps/tauri/src/index.css (1)

82-95: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Comment says "opaque" but overlay is 92% opaque.

The comment on Line 86 states "Force a full-window opaque backdrop," but color-mix(in srgb, var(--color-app) 92%, transparent) leaves 8% transparency. The blur(16px) makes it effectively opaque visually, so this is likely intentional for a frosted-glass effect. Consider updating the comment to say "near-opaque" or "frosted" for accuracy.

🤖 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/tauri/src/index.css` around lines 82 - 95, The comment for the
full-window backdrop in the `.fixed.inset-0.z-\[102\]` rule is inaccurate
because the `background-color` still uses 92% opacity and the blur creates a
frosted effect rather than a truly opaque one. Update the comment near this CSS
block to describe it as near-opaque or frosted-glass instead of opaque, keeping
the wording aligned with the actual styling in `index.css`.
apps/tauri/vite.config.ts (1)

10-16: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Version selection is nondeterministic when multiple versions are hoisted.

readdirSync(...).find(entry => entry.startsWith(${packageName}@)) returns the first directory in filesystem order. If Bun's store holds more than one version of a package, an arbitrary version is picked. Consider sorting/selecting deterministically (or asserting a single match) to avoid subtle build differences.

🤖 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/tauri/vite.config.ts` around lines 10 - 16, The package resolution in
the bun path lookup is nondeterministic because the current find on readdirSync
can return an arbitrary version when multiple hoisted entries exist. Update the
version selection logic in the path-resolution helper in vite.config.ts to
deterministically choose the intended package version, such as by sorting
matches or requiring exactly one match, and keep the existing error handling in
the same helper so ambiguous matches do not silently pick different versions
across builds.
core/src/ops/files/query/directory_listing.rs (1)

231-239: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract duplicated sort-direction resolution into a helper.

The exact same unwrap_or_else(default_sort_direction) expression is repeated verbatim in query_indexed_directory_impl and sort_files. Consolidating avoids drift if the fallback logic ever changes.

♻️ Proposed refactor
 impl DirectoryListingQuery {
+	fn resolved_sort_direction(&self) -> SortDirection {
+		self.input
+			.sort_direction
+			.clone()
+			.unwrap_or_else(|| Self::default_sort_direction(&self.input.sort_by))
+	}
+
 	fn default_sort_direction(sort_by: &DirectorySortBy) -> SortDirection {
 		match sort_by {
 			DirectorySortBy::Name | DirectorySortBy::Type => SortDirection::Asc,
 			DirectorySortBy::Modified | DirectorySortBy::Size => SortDirection::Desc,
 		}
 	}

Then replace both call sites:

-		let direction = self
-			.input
-			.sort_direction
-			.clone()
-			.unwrap_or_else(|| Self::default_sort_direction(&self.input.sort_by));
+		let direction = self.resolved_sort_direction();

Also applies to: 833-837

🤖 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 `@core/src/ops/files/query/directory_listing.rs` around lines 231 - 239, The
sort-direction fallback logic is duplicated in query_indexed_directory_impl and
sort_files, so extract the repeated
self.input.sort_direction.clone().unwrap_or_else(||
Self::default_sort_direction(&self.input.sort_by)) into a shared helper on
DirectoryListing. Update both call sites to use that helper and keep the
ASC/DESC mapping unchanged so any future fallback change stays in one place.
packages/interface/src/components/TabManager/TabManagerContext.tsx (1)

87-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate SortOrder type declaration.

sortUtils.ts already exports SortOrder = "asc" | "desc", and context.tsx imports/re-exports it from there. This file instead redeclares an identical type independently, risking drift if the value set ever changes in only one place.

Since components/TabManager is lower-level than routes/explorer, importing from sortUtils.ts directly would invert the existing dependency direction (routes already import types from TabManagerContext). Consider relocating SortOrder (and possibly defaultSortOrder) to a shared location both modules can depend on without new coupling.

Also applies to: 113-113

🤖 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 `@packages/interface/src/components/TabManager/TabManagerContext.tsx` around
lines 87 - 93, Remove the duplicate SortOrder declaration from TabManagerContext
and reuse the single source of truth already defined in sortUtils.ts. Update
TabManagerContext, TabExplorerState, and any related exports/imports (including
defaultSortOrder if needed) so both TabManager and explorer code depend on a
shared type instead of redefining it locally. Keep the existing dependency
direction intact by moving any shared sort constants/types to a common location
if TabManagerContext still needs them.
🤖 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/tauri/src/index.css`:
- Around line 14-15: Stylelint is flagging Tailwind v4’s `@source` rule as an
unknown at-rule, so update the Stylelint configuration to ignore source under
scss/at-rule-no-unknown. Use the existing Stylelint config entry where other
Tailwind at-rules like tailwind, apply, and layer are listed, and add source to
that ignoreAtRules list so the `@source` declarations in index.css stop failing
lint.

In `@packages/interface/src/routes/explorer/views/KnowledgeView.tsx`:
- Around line 95-96: The directory listing query in KnowledgeView is passing
sortBy without the narrower DirectorySortBy type, which should be aligned with
the generated input expected by this request. Update the query construction in
KnowledgeView to cast or narrow sortBy to DirectorySortBy, matching the other
directory view call sites and keeping the sort input consistent with the
directory listing API.

---

Outside diff comments:
In `@packages/interface/src/routes/explorer/hooks/useExplorerKeyboard.ts`:
- Around line 49-56: The directory listing query in useExplorerKeyboard is
missing folders_first, which can cause keyboard navigation to use a different
ordering than the rest of the views. Update the input object built from
currentPath to include folders_first using the already destructured
viewSettings, matching the behavior in useExplorerFiles, ColumnView,
KnowledgeView, and SizeView so arrow-key navigation stays consistent with the
displayed order.

---

Nitpick comments:
In `@apps/tauri/src/index.css`:
- Around line 82-95: The comment for the full-window backdrop in the
`.fixed.inset-0.z-\[102\]` rule is inaccurate because the `background-color`
still uses 92% opacity and the blur creates a frosted effect rather than a truly
opaque one. Update the comment near this CSS block to describe it as near-opaque
or frosted-glass instead of opaque, keeping the wording aligned with the actual
styling in `index.css`.

In `@apps/tauri/vite.config.ts`:
- Around line 10-16: The package resolution in the bun path lookup is
nondeterministic because the current find on readdirSync can return an arbitrary
version when multiple hoisted entries exist. Update the version selection logic
in the path-resolution helper in vite.config.ts to deterministically choose the
intended package version, such as by sorting matches or requiring exactly one
match, and keep the existing error handling in the same helper so ambiguous
matches do not silently pick different versions across builds.

In `@core/src/ops/files/query/directory_listing.rs`:
- Around line 231-239: The sort-direction fallback logic is duplicated in
query_indexed_directory_impl and sort_files, so extract the repeated
self.input.sort_direction.clone().unwrap_or_else(||
Self::default_sort_direction(&self.input.sort_by)) into a shared helper on
DirectoryListing. Update both call sites to use that helper and keep the
ASC/DESC mapping unchanged so any future fallback change stays in one place.

In `@packages/interface/src/components/TabManager/TabManagerContext.tsx`:
- Around line 87-93: Remove the duplicate SortOrder declaration from
TabManagerContext and reuse the single source of truth already defined in
sortUtils.ts. Update TabManagerContext, TabExplorerState, and any related
exports/imports (including defaultSortOrder if needed) so both TabManager and
explorer code depend on a shared type instead of redefining it locally. Keep the
existing dependency direction intact by moving any shared sort constants/types
to a common location if TabManagerContext still needs them.
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c3d1264d-391e-4901-bfee-907c17f4ba6a

📥 Commits

Reviewing files that changed from the base of the PR and between e824b6b and cda9429.

⛔ Files ignored due to path filters (1)
  • packages/ts-client/src/generated/types.ts is excluded by !**/generated/**, !**/generated/**
📒 Files selected for processing (18)
  • apps/cli/src/domains/file/mod.rs
  • apps/tauri/src/index.css
  • apps/tauri/src/stubs/debug.ts
  • apps/tauri/src/stubs/spacebot-api-client.ts
  • apps/tauri/vite.config.ts
  • core/src/ops/files/query/directory_listing.rs
  • core/tests/normalized_cache_fixtures_test.rs
  • packages/interface/src/components/TabManager/TabManagerContext.tsx
  • packages/interface/src/routes/explorer/ExplorerView.tsx
  • packages/interface/src/routes/explorer/context.tsx
  • packages/interface/src/routes/explorer/hooks/useExplorerFiles.ts
  • packages/interface/src/routes/explorer/hooks/useExplorerKeyboard.ts
  • packages/interface/src/routes/explorer/sortUtils.ts
  • packages/interface/src/routes/explorer/views/ColumnView/Column.tsx
  • packages/interface/src/routes/explorer/views/ColumnView/ColumnView.tsx
  • packages/interface/src/routes/explorer/views/KnowledgeView.tsx
  • packages/interface/src/routes/explorer/views/ListView/ListView.tsx
  • packages/interface/src/routes/explorer/views/SizeView/SizeView.tsx
✅ Files skipped from review due to trivial changes (1)
  • apps/tauri/src/stubs/debug.ts

Comment thread apps/tauri/src/index.css
Comment on lines +14 to +15
@source "../node_modules/@spacedrive/primitives/dist";
@source "../node_modules/@spacedrive/ai/dist";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Configure Stylelint to recognize Tailwind v4 @source at-rule.

Stylelint reports @source as an unknown at-rule (scss/at-rule-no-unknown). This is a false positive — @source is valid Tailwind v4 CSS syntax for specifying additional content sources. Add it to the ignore list in your Stylelint config to suppress the error.

🔧 Suggested Stylelint config fix
// In .stylelintrc or stylelint config:
{
  "rules": {
    "scss/at-rule-no-unknown": [true, {
      "ignoreAtRules": ["source", "tailwind", "apply", "layer", "config", "plugin", "variant", "custom-variant", "utility"]
    }]
  }
}
🧰 Tools
🪛 Stylelint (17.14.0)

[error] 14-14: Unexpected unknown at-rule "@source" (scss/at-rule-no-unknown)

(scss/at-rule-no-unknown)


[error] 15-15: Unexpected unknown at-rule "@source" (scss/at-rule-no-unknown)

(scss/at-rule-no-unknown)

🤖 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/tauri/src/index.css` around lines 14 - 15, Stylelint is flagging
Tailwind v4’s `@source` rule as an unknown at-rule, so update the Stylelint
configuration to ignore source under scss/at-rule-no-unknown. Use the existing
Stylelint config entry where other Tailwind at-rules like tailwind, apply, and
layer are listed, and add source to that ignoreAtRules list so the `@source`
declarations in index.css stop failing lint.

Source: Linters/SAST tools

Comment on lines +95 to +96
sort_by: sortBy,
sort_direction: toSortDirection(sortOrder),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check the directory listing query input type for sort_by field
rg -n "sort_by" --type=ts -g '!**/node_modules/**' -C2 packages/ | head -60

Repository: spacedriveapp/spacedrive

Length of output: 4685


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the view file and the generated query types around sort_by/sortBy.
FILE=packages/interface/src/routes/explorer/views/KnowledgeView.tsx
TYPES=packages/ts-client/src/generated/types.ts

printf '\n## KnowledgeView.tsx outline\n'
ast-grep outline "$FILE" --view expanded || true

printf '\n## KnowledgeView.tsx relevant lines\n'
sed -n '1,180p' "$FILE" | cat -n

printf '\n## Generated types around DirectorySortBy / sort_by\n'
rg -n "DirectorySortBy|sort_by: DirectorySortBy|type SortBy|export type SortBy" "$TYPES" -n -C2

Repository: spacedriveapp/spacedrive

Length of output: 6605


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Determine the type of `sortBy` from explorer context and the directory query input type.
CONTEXT_FILE=packages/interface/src/routes/explorer/context.ts
QUERY_FILE=packages/interface/src/routes/explorer/views/KnowledgeView.tsx
TYPES=packages/ts-client/src/generated/types.ts

printf '\n## useExplorer / sortBy definitions\n'
ast-grep outline "$CONTEXT_FILE" --view expanded || true
rg -n "sortBy|sortOrder|DirectorySortBy|MediaSortBy|SortBy" "$CONTEXT_FILE" "$QUERY_FILE" "$TYPES" -C2

printf '\n## Query type for files.directory_listing\n'
rg -n "files\.directory_listing|directory_listing|sort_by: DirectorySortBy" "$TYPES" -C3

Repository: spacedriveapp/spacedrive

Length of output: 2812


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the explorer context/provider and inspect the `sortBy` type.
fd -a 'context.ts' packages/interface/src/routes/explorer
fd -a 'context.tsx' packages/interface/src/routes/explorer
fd -a 'context.*' packages/interface/src/routes/explorer

printf '\n## Search for useExplorer / sortBy definitions\n'
rg -n "useExplorer|sortBy|sortOrder" packages/interface/src/routes/explorer -C3

Repository: spacedriveapp/spacedrive

Length of output: 50380


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect how KnowledgeView is selected and whether it can see a MediaSortBy value.
rg -n "KnowledgeView|viewMode|SortBy =|export type SortBy|type ViewMode" \
  packages/interface/src/routes/explorer -C2

printf '\n## context.tsx sort/view-mode definitions\n'
sed -n '1,240p' packages/interface/src/routes/explorer/context.tsx | cat -n
printf '\n## context.tsx sort handling section\n'
sed -n '600,760p' packages/interface/src/routes/explorer/context.tsx | cat -n
printf '\n## ExplorerView switch around KnowledgeView\n'
sed -n '1,220p' packages/interface/src/routes/explorer/ExplorerView.tsx | cat -n

Repository: spacedriveapp/spacedrive

Length of output: 50380


Cast sortBy to DirectorySortBy for this query. KnowledgeView issues a directory listing request, so this value should be narrowed to match the generated input type and stay aligned with the other directory view call sites.

🤖 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 `@packages/interface/src/routes/explorer/views/KnowledgeView.tsx` around lines
95 - 96, The directory listing query in KnowledgeView is passing sortBy without
the narrower DirectorySortBy type, which should be aligned with the generated
input expected by this request. Update the query construction in KnowledgeView
to cast or narrow sortBy to DirectorySortBy, matching the other directory view
call sites and keeping the sort input consistent with the directory listing API.

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