improvement(files): enhance file sharing - #6983
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Adds Copy Link for the private workspace file URL from the file viewer and row context menu (separate from public Share). Share reads always refetch on modal open, and file-list invalidation now runs after the mutation settles. Includes a focused Reviewed by Cursor Bugbot for commit a0d9254. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR keeps file-sharing dialogs open during mutations, adds confirmation and toast feedback, preserves durable share links across access-mode changes, and adds private workspace-file link copying.
Confidence Score: 4/5The PR appears safe to merge, with one non-blocking interaction issue while authoritative sharing settings are loading. The sharing and link-copying flows remain functional, but access controls can accept edits against stale initial data and then change their effective action when the authoritative record arrives. Files Needing Attention: apps/sim/app/workspace/[workspaceId]/files/components/share-modal/share-modal.tsx
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/files/components/share-modal/share-modal.tsx | Reworks sharing state and actions comprehensively, but permits draft edits before the authoritative post-mount read completes. |
| apps/sim/app/workspace/[workspaceId]/files/files.tsx | Adds correctly targeted private file-link copying to context and viewer actions. |
| apps/sim/hooks/queries/public-shares.ts | Forces authoritative modal refetches and invalidates workspace lists after both successful and failed mutations. |
| apps/sim/app/workspace/[workspaceId]/files/components/share-modal/share-modal.test.tsx | Provides broad coverage of the revised sharing workflow but does not exercise user edits during the authoritative-read window. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-row-context-menu/file-row-context-menu.tsx | Adds a single-file Copy Link action and distinguishes its icon from public sharing. |
| apps/sim/lib/api/contracts/public-shares.ts | Updates documentation for the existing client-reserved token contract without changing its validation. |
Sequence Diagram
sequenceDiagram
participant U as User
participant M as Share modal
participant Q as Share query
participant API as Share API
U->>M: Open file sharing
M->>Q: Refetch authoritative share
Q->>API: GET current share
API-->>Q: Active, inactive, or null share
Q-->>M: Reconcile saved configuration
U->>M: Share, update, or confirm unshare
M->>API: PUT sharing configuration
API-->>M: Durable share record
M->>Q: Update detail cache
M-->>U: Keep modal open and show feedback
Reviews (1): Last reviewed commit: "improvement(files): enhance file sharing" | Re-trigger Greptile
| <ButtonGroup | ||
| value={effectiveMode} | ||
| onValueChange={(value) => setDraftMode(value as ShareAuthType)} | ||
| aria-label='File access' | ||
| disabled={upsertShare.isPending} |
There was a problem hiding this comment.
Editable pre-fetch sharing state
Before the authoritative share read completes, the access controls accept edits against stale initial data. When the saved record arrives, it rebases those edits and can change the primary action from Update to the destructive Unshare flow, making the modal's action change underneath the user.
Summary
Type of Change
Testing
bun run lintbun run apps/sim/scripts/check-block-registry.ts origin/stagingbun run check:auditsbun run type-checkfromapps/simChecklist