Skip to content

refactor(resources): converge Files onto the shared drag hook and batch bulk authorization - #6748

Merged
waleedlatif1 merged 2 commits into
stagingfrom
refactor/foldered-drag-convergence
Aug 15, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
refactor/foldered-drag-convergence

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Files kept a 280-line copy of the foldered-list drag logic because it also accepts OS file drops, and the copies had drifted. The external drop is now an externalDrop option on the shared hook and the copy is gone — folder rows highlight and spring open for an OS file drag exactly as for a move, while the body and breadcrumb decline so the page-level upload overlay owns those regions
  • Collapsed the three drop-active booleans into one ActiveDropTarget union, so exactly one affordance is armed by construction instead of by hand-clearing the other two
  • Kept drop-target state writes identity-stable, so dragover no longer re-renders the list on every event
  • Restored per-list drag MIMEs, so the cross-surface isolation drag-payload.ts documents is true again
  • A folder can now spring open more than once per drag: descend, walk back out through the breadcrumb, descend again. The guard against re-entering the folder already on screen moved to useSpringNavigation, the only layer that can express it
  • Bulk move/delete now resolve each item against the workspace context the batch already holds, and memoize the effective-permission lookup for the batch — two invariant queries per item removed
  • Drop target fills at --surface-active; --surface-4 is the button-base token and is lighter than hover in light mode, so the strongest row state painted the faintest fill

Type of Change

  • Refactor / improvement

Testing

bun run type-check, bun run check:audits (27/27), and 4013 tests pass.

New coverage for the drag lifecycle: re-entering a folder through the breadcrumb, refusing to re-open the folder already on screen, cancelling a pending open when the drag moves onto the current folder, one-hop return to origin after a multi-level round trip, staying put when the round trip ends in a drop, and the next drag taking a fresh origin. Plus unit tests for the permission memo, including key separation and re-query after a rejection.

Not browser-tested — the convergence changes which code path Files runs, so the drag interactions are worth a manual pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Loading
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