Repository navigation
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions below.
Reviewed changes
- Drag sources —
DocsDocRowandDocsFolderNoderows becomedraggablefordocs:writeusers (except while renaming) and publish a{kind, id, parentId}payload underapplication/x-paca-doc-node. - Drop targets — a folder's whole subtree wrapper and the root Documentation container accept drops, reparenting through
updateFolder/updateDocumentand then invalidatingdocQueryKeys.all(projectId). - Guards — same-folder and folder-onto-itself drops are skipped; the server already rejects self-parent and ancestor cycles, so there is no data-integrity risk.
ℹ️ Multiple drop targets stay highlighted
isOver is per-hook state and onDragLeave deliberately ignores moves into descendants, so a parent target never yields: while the pointer is over a nested folder, the root container and every expanded ancestor folder keep their ring, and which target is actually active becomes ambiguous. The task→sprint drag in this same file keeps one dragOverInteractionId, which is the model to mirror.
Technical details
# Only one drop target should be highlighted
## Affected sites
- `apps/web/src/components/app-shell/app-sidebar.tsx:203` — `isOver` lives in each `useDocNodeDrop` instance, so the root container (`:824-828`) and every expanded ancestor folder highlight independently.
- `apps/web/src/components/app-shell/app-sidebar.tsx:235-239` — the containment check treats any descendant as still inside the parent, so the outer target never clears when the pointer enters a nested drop target.
- `apps/web/src/components/app-shell/app-sidebar.tsx:1508` (existing) — task→sprint drag uses a single active id; the same model applies here.
## Required outcome
- At most one target highlighted at a time: the innermost folder under the pointer, or the root container when the pointer is over root-level rows or empty space.
## Suggested approach
- Lift the active target into one piece of state in `DocsSidebarSection` (e.g. `activeDocDropTarget: "root" | folderId | null`) exposed through a small context so the recursive `DocsFolderNode` needs no prop threading; both the root and per-folder highlights derive from it.ℹ️ Rejected moves toast the raw server error
Dropping a folder into its own expanded subtree is easy to trigger, and moveMutation has no onError, so the global mutation handler toasts the envelope's raw text (doc folder: moving the folder there would create a cycle). The rename mutations in this file map their error codes to docs.errors.*; this one should do the same for the folder cycle and self-parent codes.
Technical details
# Localize the rejected-move message
## Affected sites
- `apps/web/src/components/app-shell/app-sidebar.tsx:205-215` — `moveMutation` declares no `onError`, so `integrations/react-query/query-client.ts:169-173` calls `notifyError`, whose description is `getApiErrorMessage` = the envelope's `error`, set to `err.Error()` in `services/api/internal/transport/http/presenter/response.go:106`.
- `apps/web/src/lib/api-error.ts:132-134` — `ApiErrorCode` has the doc title/folder-name codes but not `DOC_FOLDER_CYCLE` / `DOC_FOLDER_SELF_PARENT`.
- `apps/web/src/components/app-shell/app-sidebar.tsx:306-313` and `:498-505` — the rename mutations show the intended code-to-`docs.errors.*` mapping.
## Required outcome
- A rejected folder move shows a translated, plain-language explanation instead of the internal message.
## Suggested approach
- Add the two codes to `ApiErrorCode` plus `docs.errors.*` strings (all 9 locale dirs; `src/i18n/locales.test.ts` enforces parity), then handle them in the mutation's `onError` with a generic fallback.ℹ️ The new capability has no touch or keyboard path
Native HTML5 drag events do not fire on touch devices, and the Documentation tree renders inside the mobile sidebar Sheet, so documents and folders cannot be reparented on mobile, or from the keyboard on desktop. Drag is now the only way to move a doc between folders, so it is worth deciding whether a "Move to…" action in the existing actions menu needs to exist as the non-drag path.
Technical details
# Non-drag path for reparenting docs and folders
## Affected sites
- `apps/web/src/components/app-shell/app-sidebar.tsx:329-335` and `:552-555` — the only move affordances, both drag-only.
- `apps/web/src/components/app-shell/app-sidebar.tsx:392-424` and `:609-632` — the existing `⋯` menus, the natural home for a "Move to folder…" item.
## Open questions for the human
- Is a menu-based move planned as a follow-up, or is this intentionally desktop-mouse-only for now?deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
…, enhance error handling and notifications
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Single active drop target — per-node
isOverstate is replaced by aDocDropTargetContextholding one"root" | folderId | nullvalue inDocsSidebarSection, cleared ondragend, so ancestor folders and the root container no longer stay ringed together. - Localized move failures —
moveMutationnow declaresonError, mappingDOC_FOLDER_CYCLE/DOC_FOLDER_SELF_PARENTto a newdocs.errors.moveIntoSelftoast and falling back tonotifyErrorwithdocs.errors.moveFailed. DeclaringonErroralso correctly suppresses the global mutation toast. - Error codes and strings — both doc-folder codes were added to
ApiErrorCode, withdocs.errors.moveIntoSelf/moveFailedpresent in all nine locale files (JSON parses, key sets stay in parity). - Root drop area extracted — the root container moved into
DocsRootDropArea, wrapping the same folder/doc rows plus the add menu, with unchanged drop behavior.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
…, add move to top feature and enhance payload validation
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
Since the prior review at 0b0a6ea, this delta:
- Extracted drag payload parsing/validation and the move-blocking guard into
doc-dnd.ts, with colocated unit tests for both helpers. - Added
projectIdto the drag payload so a payload dragged from another project or browser tab is rejected. - Added a client-side ancestor guard: a folder can no longer be dropped into itself or a rendered descendant, so the server no longer round-trips those moves.
- Narrowed post-move cache invalidation to the source and target child lists plus the moved node's own path/detail, instead of the whole docs prefix.
- Auto-expanded a collapsed drop target after a successful move so the moved item is visible.
- Moved the drag handlers onto each row's main button (Firefox cannot start a drag from a button nested in a draggable parent), and added a "Move to top level" menu action with strings in all nine locales.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior review at 0b34f86:
- Broadened folder-path invalidation — a folder move now marks the
folders/pathquery prefix stale instead of only the moved folder's own path, so documents open inside descendant folders pick up their new breadcrumb immediately. Verified the prefix matchesdocQueryKeys.folderPath(apps/web/src/lib/doc-api.ts:147-148) and does not overlap thefolderChildren/docChildrenkeys.
This addresses the one inline finding from the previous review; the thread is resolved.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Summary
Adds drag-and-drop to the Documentation tree in the sidebar so documents and folders can be moved between folders.
Changes
All in
apps/web/src/components/app-shell/app-sidebar.tsx:docs:write. Rows are not draggable while being renamed.updateDocument(folder_id) andupdateFolder(parent_id) endpoints, then invalidates the docs query keys so the tree refreshes.Not included
Testing
tsc -band Biome pass.