Skip to content

Conversation

Ludovico7
Copy link
Collaborator

📝 변경 사항

  • WebSocket 및 DnD로직 별도 Provider 컴포넌트로 분리

🔍 변경 사항 설명

  • 기존 Editor.tsx 내부에 너무 많은 로직들이 포함되어 있어 블록으로 props를 전달하지 않는 로직은 별도 Provider컴포넌트로 분리했습니다.
  • 나중에 서윤님이 리스트 가상화 코드 제거한 버전도 반영하게 되면 좀더 깔끔하게 코드 구조를 유지할수 있지 않을까 싶습니다.
  • 자세한 사항은 회의때 말씀드리겠습니다!

🙏 질문 사항

테스트가 완료되지 않아 Approve하면 안될것 같습니다!

📷 스크린샷 (선택)

✅ 작성자 체크리스트

  • Self-review: 코드가 스스로 검토됨
  • Unit tests 추가 또는 수정
  • 로컬에서 모든 기능이 정상 작동함
  • 린터 및 포맷터로 코드 정리됨
  • 의존성 업데이트 확인
  • 문서 업데이트 또는 주석 추가 (필요 시)

@Ludovico7 Ludovico7 self-assigned this Jun 13, 2025
@Ludovico7 Ludovico7 added Refactor refactor codes FE Front End labels Jun 13, 2025
@Ludovico7 Ludovico7 requested a review from Copilot June 13, 2025 16:05
Copilot

This comment was marked as outdated.

@Ludovico7 Ludovico7 requested a review from Copilot June 13, 2025 16:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Editor component by separating the WebSocket and Drag-and-Drop (DnD) logic into dedicated Provider components for better modularity and readability.

  • Extracted WebSocket logic into a new WebSocketProvider
  • Moved DnD logic into a new DndProvider
  • Removed composition handling and block insertion logic from Editor.tsx in favor of dedicated hooks and providers

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
client/src/stores/useSocketStore.ts Exported the RemoteOperationHandlers interface for broader usage.
client/src/features/editor/provider/WebsocketProvider.tsx New provider handling remote socket subscriptions; consider updating dependencies.
client/src/features/editor/provider/DndProvider.tsx New provider encapsulating DnD functionality using the @dnd-kit/core APIs.
client/src/features/editor/hooks/useEditorOperation.ts Removed redundant block insertion logic for cleaner separation of concerns.
client/src/features/editor/hooks/useComposition.ts New hook for handling text composition events.
client/src/features/editor/Editor.tsx Refactored Editor to use the new providers and hooks, simplifying its internal logic.
Comments suppressed due to low confidence (2)

client/src/features/editor/provider/WebsocketProvider.tsx:90

  • The useEffect dependency array does not include handleRemoteBlockCheckbox even though it's passed to subscribeToRemoteOperations; add it to ensure the effect updates correctly when its reference changes.
],

client/src/features/editor/Editor.tsx:179

  • The check verifies if editorCRDT is truthy, but since editorCRDT is a React ref, consider checking editorCRDT.current instead to avoid unintended behavior.
if (!editorCRDT) return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FE Front End Refactor refactor codes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant