refactor: align file mentions with sandbox files flow (#1664)#1675
Conversation
* feat: move file list to dedicated api * refactor: share listed file row type * fix: update listed file row import * refactor: drop unused owner email field * refactor: keep mentions on sandbox file list * refactor: source mentions from sandbox file tree * chore: remove unused file listing route and hooks * fix: restore mention image thumbnails from sandbox * refactor: move mention preview loading into suggestion item * refactor: extract sandbox mention preview hook * refactor: unify sandbox file content hooks * fix: allow optional selected path in sandbox file content hook * fix: trim sandbox root prefix in mention paths * refactor: extract WORKSPACE_ORGS_PATH to shared module The .openclaw/workspace/orgs prefix was duplicated in useArtistFilesForMentions (file-mention picker) and getSubtreeAtPath (/files page filetree). Share a single const so both stay in lockstep if the sandbox layout changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: only export WORKSPACE_ORGS_PATH, derive PREFIX at call site Drop the WORKSPACE_ORGS_PREFIX export. The only caller that needs the trailing `/` constructs it locally, keeping the shared module minimal. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Sweets Sweetman <sweetmantech@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR replaces the legacy file manager API and file listing hooks with a sandbox file tree-based approach. It removes the Changes
Sequence DiagramsequenceDiagram
participant User as User (Typing @)
participant FileMentionsInput
participant useArtistFilesForMentions
participant useSandboxes
participant SuggestionItem
participant useSandboxFileContent
participant QueryClient as React Query
User->>FileMentionsInput: Type `@mention` trigger
FileMentionsInput->>useArtistFilesForMentions: Request file suggestions
useArtistFilesForMentions->>useSandboxes: Fetch filetree & isLoading
useSandboxes-->>useArtistFilesForMentions: Return FileNode tree
useArtistFilesForMentions->>useArtistFilesForMentions: Flatten tree to MentionableFile[]
useArtistFilesForMentions-->>FileMentionsInput: Return {files, isLoading}
FileMentionsInput->>SuggestionItem: Render each file (entry, highlightedDisplay)
SuggestionItem->>useSandboxFileContent: Query file content/imageUrl (if isImage)
useSandboxFileContent->>QueryClient: useQuery({path, enabled})
QueryClient-->>useSandboxFileContent: Fetch & cache file content
useSandboxFileContent-->>SuggestionItem: Return {content, imageUrl, loading}
SuggestionItem->>SuggestionItem: Render image preview or fallback icon
SuggestionItem-->>User: Display suggestion with thumbnail
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Possibly related PRs
Suggested reviewers
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
feat: move file list to dedicated api
refactor: share listed file row type
fix: update listed file row import
refactor: drop unused owner email field
refactor: keep mentions on sandbox file list
refactor: source mentions from sandbox file tree
chore: remove unused file listing route and hooks
fix: restore mention image thumbnails from sandbox
refactor: move mention preview loading into suggestion item
refactor: extract sandbox mention preview hook
refactor: unify sandbox file content hooks
fix: allow optional selected path in sandbox file content hook
fix: trim sandbox root prefix in mention paths
refactor: extract WORKSPACE_ORGS_PATH to shared module
The .openclaw/workspace/orgs prefix was duplicated in useArtistFilesForMentions (file-mention picker) and getSubtreeAtPath (/files page filetree). Share a single const so both stay in lockstep if the sandbox layout changes.
Drop the WORKSPACE_ORGS_PREFIX export. The only caller that needs the trailing
/constructs it locally, keeping the shared module minimal.Summary by cubic
Aligns the file mention picker with the sandbox file flow. Mentions now source from the sandbox file tree and load previews/attachments via a unified sandbox content hook, while legacy file listing APIs and hooks are removed.
Refactors
storage_keytopathand derive MIME viagetMimeFromPath..openclaw/workspace/orgsasWORKSPACE_ORGS_PATHand reuse it across the file picker and/filestree.SuggestionItemusinguseSandboxFileContent(nowuseQuery-based with optional path)./api/files/list,useFilesManager, anduseBatchSignedUrls.Bug Fixes
Written for commit 877d35a. Summary will update on new commits.
Summary by CodeRabbit
Release Notes