Skip to content

Comments

feat: use TodoListTable and fix update logic in edit todo button#131

Merged
yesyash merged 6 commits intodevelopfrom
yash/watchlist
Jul 18, 2025
Merged

feat: use TodoListTable and fix update logic in edit todo button#131
yesyash merged 6 commits intodevelopfrom
yash/watchlist

Conversation

@yesyash
Copy link
Contributor

@yesyash yesyash commented Jul 18, 2025

Date: 19 july 2025

Developer Name: yash raj


Issue Ticket Number

  • N/A

Description

  • use the common TodoListTable in the dashboard watchlist tab.
  • fix the update logic when editing a todo.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

image

Description by Korbit AI

What change is being made?

Refactor task creating and editing logic by introducing CrateTaskReqDto, utilizing TodoListTable for the dashboard watchlist, refining error handling in form submissions, and modifying the task update logic to handle user assignments.

Why are these changes being made?

These changes ensure better type handling with CrateTaskReqDto, enhance the user interface with a unified table component (TodoListTable), and improve the robustness of form submissions with error message displays. The refined logic in task updates ensures seamless user assignments, making the code more understandable and reducing the potential for runtime errors.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@yesyash yesyash self-assigned this Jul 18, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 18, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Summary by CodeRabbit

  • New Features

    • Added support for assigning tasks to users or teams directly from the create/edit task form.
    • Introduced a new dashboard watchlist table that displays tasks in the user's watchlist.
  • Bug Fixes

    • Improved error handling and feedback when updating or assigning tasks.
  • Refactor

    • Replaced the previous watchlist tasks table with an improved version for better performance and consistency.

Walkthrough

The changes introduce a new DashboardWatchlistTable component to replace the previous DashboardWatchlistTasksTable for watchlist task display. The form in create-edit-todo-form.tsx now includes assigneeId and userType in its state. The edit task button logic is refactored for simplified, sequential mutation and unified error handling.

Changes

File(s) Change Summary
components/create-edit-todo-form.tsx Extended form default values to include assigneeId and userType; minor prop reordering for SubmitButton.
components/edit-task-button.tsx Refactored mutation logic to use sequential, awaited mutations with unified error handling and state tracking.
modules/dashboard/components/dashboard-tabs.tsx Swapped out DashboardWatchlistTasksTable for new DashboardWatchlistTable in the WatchList tab.
modules/dashboard/components/dashboard-watchlist-table.tsx Added new DashboardWatchlistTable component to fetch, transform, and display watchlist tasks.
modules/dashboard/components/dashboard-watchlist-tasks-table.tsx Deleted old DashboardWatchlistTasksTable component.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EditTaskButton
    participant UpdateTaskMutation
    participant AssignMutation
    participant Toast
    participant QueryCache

    User->>EditTaskButton: Submit edit
    EditTaskButton->>UpdateTaskMutation: mutateAsync(updateTask)
    UpdateTaskMutation-->>EditTaskButton: success/failure
    alt Update success
        EditTaskButton->>AssignMutation: mutateAsync(assign if needed)
        AssignMutation-->>EditTaskButton: success/failure
        alt All mutations succeed
            EditTaskButton->>Toast: show success
            EditTaskButton->>QueryCache: invalidate task query
            EditTaskButton->>User: close edit form
        else Any mutation fails
            EditTaskButton->>Toast: show error
        end
    else Update fails
        EditTaskButton->>Toast: show error
    end
Loading

Possibly related PRs

  • Real-Dev-Squad/todo-frontend#115: Replaces the old watchlist tasks table with the new DashboardWatchlistTable, directly affecting how watchlist tasks are fetched and displayed.

Poem

In the dashboard’s gentle glow,
A watchlist table steals the show.
Tasks assigned with care anew,
Buttons refactored, logic true.
Old code hops out, new hops in—
A tidy change, let’s bunny-grin!
🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

@yesyash yesyash changed the title feat: use TodoListTable and fix update logic in create edit task button feat: use TodoListTable and fix update logic in edit task button Jul 18, 2025
@yesyash yesyash changed the title feat: use TodoListTable and fix update logic in edit task button feat: use TodoListTable and fix update logic in edit todo button Jul 18, 2025
AnujChhikara
AnujChhikara previously approved these changes Jul 18, 2025
@yesyash yesyash dismissed stale reviews from AnujChhikara and Achintya-Chatterjee via cf9253b July 18, 2025 19:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ca2953 and 21d3dd4.

📒 Files selected for processing (5)
  • components/create-edit-todo-form.tsx (2 hunks)
  • components/edit-task-button.tsx (1 hunks)
  • modules/dashboard/components/dashboard-tabs.tsx (2 hunks)
  • modules/dashboard/components/dashboard-watchlist-table.tsx (1 hunks)
  • modules/dashboard/components/dashboard-watchlist-tasks-table.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • modules/dashboard/components/dashboard-watchlist-tasks-table.tsx
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#51
File: __mocks__/types.ts:33-34
Timestamp: 2025-07-09T08:59:13.002Z
Learning: In the todo-frontend project, the PATCH task API endpoint payload uses `dueAt` and `startedAt` field names, but these update the `dueDate` and `startDate` fields respectively in the Task object. This is intentional according to the API contract design.
modules/dashboard/components/dashboard-tabs.tsx (1)
Learnt from: yesyash
PR: Real-Dev-Squad/todo-frontend#109
File: app/(internal-routes)/teams/[teamId]/layout.tsx:8-15
Timestamp: 2025-07-16T13:18:36.847Z
Learning: In Next.js layout components, error handling and validation for params extraction (like `const { teamId } = await params`) is not required in this codebase. The framework handles routing validation adequately.
components/create-edit-todo-form.tsx (1)
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#51
File: __mocks__/types.ts:33-34
Timestamp: 2025-07-09T08:59:13.002Z
Learning: In the todo-frontend project, the PATCH task API endpoint payload uses `dueAt` and `startedAt` field names, but these update the `dueDate` and `startDate` fields respectively in the Task object. This is intentional according to the API contract design.
components/edit-task-button.tsx (1)
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#51
File: __mocks__/types.ts:33-34
Timestamp: 2025-07-09T08:59:13.002Z
Learning: In the todo-frontend project, the PATCH task API endpoint payload uses `dueAt` and `startedAt` field names, but these update the `dueDate` and `startDate` fields respectively in the Task object. This is intentional according to the API contract design.
🧬 Code Graph Analysis (1)
modules/dashboard/components/dashboard-tabs.tsx (1)
modules/dashboard/components/dashboard-watchlist-table.tsx (1)
  • DashboardWatchlistTable (7-26)
🔇 Additional comments (5)
modules/dashboard/components/dashboard-tabs.tsx (2)

9-10: Import + usage update looks good

The swap from DashboardWatchlistTasksTable to DashboardWatchlistTable is consistent and compiles cleanly. 👍


48-50: LGTM on component replacement

Rendering the new <DashboardWatchlistTable /> inside the WatchList tab matches the updated import. No further changes required.

components/create-edit-todo-form.tsx (2)

127-128: LGTM!

Good addition of assigneeId and userType to the form's default values. This ensures proper initialization and aligns with the form schema definition.


286-286: Prop reordering looks good.

The isDisabled prop reordering maintains the same functionality.

components/edit-task-button.tsx (1)

23-27: Clean mutation setup!

Good simplification by removing inline handlers and using mutateAsync for better control flow.

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Error Handling Generic Error Handling Without Context ▹ view
Design Data transformation logic mixed with component ▹ view
Functionality Unsafe null handling in tasks mapping ▹ view
Readability Magic Number in Priority Fallback ▹ view ✅ Fix detected
Performance Delayed Query Invalidation ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
modules/dashboard/components/dashboard-watchlist-table.tsx
modules/dashboard/components/dashboard-tabs.tsx
components/edit-task-button.tsx
components/create-edit-todo-form.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

@yesyash yesyash merged commit f675f9c into develop Jul 18, 2025
2 checks passed
@yesyash yesyash deleted the yash/watchlist branch July 18, 2025 19:56
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.

3 participants