Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 이동중 오늘 할일 조회 에러 해결 & 추천 할 일을 추가할 때마다 새로고침되는 문제 해결 & 드래그 앤 드롭에 의한 클릭 이벤트 방지 #248

Merged
merged 10 commits into from
Feb 26, 2025

Conversation

rbgksqkr
Copy link
Collaborator

@rbgksqkr rbgksqkr commented Feb 26, 2025

Issue Number

close #247

As-Is

  • 이동중일 때 즐겨찾기 목록에서 오늘 할 일을 못불러옴
  • 드래그 앤 드롭에 의한 터치 이벤트가 막혀있지 않음
  • 추천 할 일을 추가할 때마다 새로고침되는 문제

To-Be

  • 드래그 앤 드롭에 의한 클릭 이벤트 방지
  • 이동중 즐겨찾기 목록에서 오늘 할 일을 불러오지 못해 에러 발생하는 문제 해결
  • 추천 할 일을 추가할 때마다 데이터를 다시 불러오는 문제 해결

Check List

  • 테스트가 전부 통과되었나요?
  • 모든 commit이 push 되었나요?
  • merge할 branch를 확인했나요?
  • Assignee를 지정했나요?
  • Label을 지정했나요?

Test Screenshot

(Optional) Additional Description

드래그 앤 드롭에 의한 터치 이벤트 방지

  • 드래그된 요소에만 e.preventDefault()가 호출되고, 다른 요소에서는 동작
  • 하나의 리스트 내에서만 레이아웃이 변경되므로, 아이템 각각이 아닌 리스트 내에서 dragging 중인지 체크함
  • 드래그 놓은 위치가 리스트 외부일 경우에 드래그 요소에 클릭 이벤트가 발생하는데, 글로벌 이벤트 리스너 등록으로 해결
  • 이벤트 핸들러가 이중으로 호출되는 문제를 stopPropagation을 통해 버블링을 통한 이벤트 전파 방지

이동중 즐겨찾기 목록에서 오늘 할 일을 불러오지 못해 에러 발생하는 문제 해결

  • 오늘 할 일을 불러오는 이유는 수정하기 탭에서 오늘 할 일 개수를 체크하기 위해 불러왔고, 즐겨찾기 페이지에서는 필요없지만 컴포넌트를 공용으로 사용해서 해당 문제가 발생
  • planId를 즐겨찾기 페이지에 넘겨주는 방식도 존재, 하지만 navigate 방식이 번거로워 에러 처리로 해결

추천 할 일을 추가할 때마다 데이터를 다시 불러오는 문제 해결

  • 추천 할 일이 랜덤으로 불러와지고, 같은 API에 대해 invalidate할 때와 안해야할 때를 쿼리키로 구분하기 어려움이 있다는 점에서 gcTime:0 으로 설정

Summary by CodeRabbit

  • Refactor
    • Improved touch and drag interactions on the planning page for a smoother, more reliable experience.
    • Streamlined the handling of drag states for task items, resulting in enhanced responsiveness during drag-and-drop actions.
    • Introduced a new property to track dragging state for todo items, simplifying the component logic.

@rbgksqkr rbgksqkr linked an issue Feb 26, 2025 that may be closed by this pull request
1 task
@rbgksqkr rbgksqkr self-assigned this Feb 26, 2025
Copy link
Contributor

coderabbitai bot commented Feb 26, 2025

Warning

Rate limit exceeded

@rbgksqkr has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 76ae194 and ec5a018.

📒 Files selected for processing (10)
  • frontend/src/constants/message.ts (2 hunks)
  • frontend/src/pages/EditPage/components/FavoriteTab/index.tsx (1 hunks)
  • frontend/src/pages/EditPage/components/RecommendTab/index.tsx (0 hunks)
  • frontend/src/pages/EditPage/hooks/useAddTodoFromArchivedMutation.ts (0 hunks)
  • frontend/src/pages/EditPage/hooks/useAddTodoMutation.ts (0 hunks)
  • frontend/src/pages/EditPage/hooks/useDeleteTodoMutation.ts (0 hunks)
  • frontend/src/pages/EditPage/hooks/useEditTodoMutation.ts (0 hunks)
  • frontend/src/pages/EditPage/hooks/useRecommendListQuery.ts (1 hunks)
  • frontend/src/pages/PlanPage/hooks/useUpdatePathTodoMutation.ts (0 hunks)
  • frontend/src/pages/RecommendTodoPage/components/RecommendTodoContainer/index.tsx (0 hunks)

Walkthrough

This PR simplifies the drag-and-drop logic within the PlanPage components. The legacy reference (isDraggingRef) is removed from the touch event handlers in the PlanContent component, while the drag state is now managed using a new boolean flag (hasDraggingItem). The TimeBlockList computes this flag and passes it to TimeBlockItem, where conditional behavior (such as preventing view actions) is updated accordingly. No public API declarations were altered.

Changes

File(s) Change Summary
frontend/src/pages/PlanPage/components/TimeBlockContent/PlanContent/index.tsx Removed isDraggingRef and its associated logic from touch event handlers, streamlining the drag tracking process.
frontend/src/pages/PlanPage/components/TimeBlockContent/TimeBlockList/TimeBlockItem/index.tsx
frontend/src/pages/PlanPage/components/TimeBlockContent/TimeBlockList/index.tsx
Introduced a new hasDraggingItem property and a constant in the list component; updated logic to use this flag for drag handling.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant PC as PlanContent
  participant TL as TimeBlockList
  participant TI as TimeBlockItem

  U->>PC: TouchStart
  Note right of PC: Initiates long press detection (legacy ref removed)
  U->>PC: TouchMove
  Note right of PC: Cancels long press timeout if active
  U->>PC: TouchEnd
  Note right of PC: Checks dragging state based on `hasDraggingItem`
  PC->>TL: Forward dragging state
  TL->>TI: Pass `hasDraggingItem` prop
  TI->>TI: Evaluate whether to trigger view action based on drag state
Loading

Suggested labels

fix, BE

Suggested reviewers

  • khw7385

Poem

I’m a bunny with a hop,
Code paths now smooth, they never stop.
I nibbled away the unused state,
Leaving drag logic feeling great.
Hop on through clean, crisp code—
A coder’s delight on this joyous road!
🐰 Happy hopping in our refactored mode!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@rbgksqkr rbgksqkr added the FE 프론트엔드 작업 label Feb 26, 2025
@rbgksqkr rbgksqkr added this to the [FE] 4차 스프린트 milestone Feb 26, 2025
Copy link
Collaborator

@young-jin-son young-jin-son left a comment

Choose a reason for hiding this comment

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

와 드래그 이벤트와 클릭 이벤트를 처리하는 게 쉽지 않을 것 같은데 고생하셨습니다!!
approve할게요 🚀🚀

@rbgksqkr rbgksqkr changed the title [FIX] 즐겨찾기 페이지에서 오늘 할 일 조회 시 에러 해결 [FIX] 이동중 오늘 할일 조회 에러 해결 & 추천 할 일을 추가할 때마다 새로고침되는 문제 해결 & 드래그 앤 드롭에 의한 터치 이벤트 방지 Feb 26, 2025
@rbgksqkr rbgksqkr changed the title [FIX] 이동중 오늘 할일 조회 에러 해결 & 추천 할 일을 추가할 때마다 새로고침되는 문제 해결 & 드래그 앤 드롭에 의한 터치 이벤트 방지 [FIX] 이동중 오늘 할일 조회 에러 해결 & 추천 할 일을 추가할 때마다 새로고침되는 문제 해결 & 드래그 앤 드롭에 의한 클릭 이벤트 방지 Feb 26, 2025
@rbgksqkr rbgksqkr merged commit 2aa0823 into develop Feb 26, 2025
4 checks passed
@rbgksqkr rbgksqkr deleted the fix/#247 branch February 26, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FE 프론트엔드 작업
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX] 즐겨찾기 페이지에서 오늘 할 일 조회 시 에러 해결
2 participants