feat(S-DOCS2): 트리 D&D 크로스-부모 이동 — parent_id 변경 + 순환 이동 방지#245
Merged
AngryJay91 merged 2 commits intomainfrom Apr 15, 2026
Merged
feat(S-DOCS2): 트리 D&D 크로스-부모 이동 — parent_id 변경 + 순환 이동 방지#245AngryJay91 merged 2 commits intomainfrom
AngryJay91 merged 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- isDescendant() 순수 함수: 순환 이동 감지 (자기 하위로 드롭 차단)
- DocTreeProps에 onMove / onMoveDenied 추가
- handleDragEnd: 크로스-부모 드롭 시 onMove 호출; 순환·권한 없을 때 onMoveDenied 콜백
- 기존 same-parent 재정렬 동작 유지
- DocsShellClient: handleMove (PATCH /api/docs/{id} parent_id+sort_order) 연동
- ToastContainer로 차단 사유(circular/no-permission) 토스트 표시
- i18n: moveCircularError / movePermissionError 키 추가 (en, ko)
- 유닛 12케이스 (isDescendant 7 + drag guard 5), type-check 클린
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5634b6c to
2a27a30
Compare
handleDragEnd was using overDoc.parent_id as newParentId, placing the dragged node as a sibling of the drop target instead of a child. Fix: use overDoc.id so the drop target becomes the new parent. Sync simulateDrag helper + expected values to match corrected behaviour. 12/12 doc-tree tests green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
S-DOCS2 — 트리 D&D 크로스-부모 문서 이동
변경 파일:
doc-tree.tsx,docs-shell-client.tsx,doc-tree.test.ts,en.json,ko.jsonAC 체크리스트
onMove(docId, newParentId, newSortOrder)콜백으로 PATCH/api/docs/{id}호출isDescendant(docs, activeDoc.id, overDoc.id)순수 함수로 감지onMoveDenied('circular')→ 에러 토스트onMoveprop 미제공 시 크로스-부모 드롭 차단onMoveDenied('no-permission')→ 경고 토스트주요 구현
doc-tree.tsxdocs-shell-client.tsxhandleMove: PATCH/api/docs/{id}{ parent_id, sort_order }+ optimistic updatehandleMoveDenied:useToast→addToast(circular=error, no-permission=warning)<ToastContainer>추가유닛 테스트 12케이스 (doc-tree.test.ts)
isDescendant7케이스: 직접 자식, 손자, 형제, 역방향, 무관, 존재하지 않는 노드Test plan
pnpm vitest run "doc-tree.test"→ 12/12 passpnpm type-check→ 5 successful🤖 Generated with Claude Code