fix invalidation when creating / editing a todo#148
Conversation
Summary by CodeRabbit
WalkthroughThe updateTask API method was changed to return the updated task data. Components handling task creation, editing, and reassignment now perform more granular cache invalidation based on the assignee's user type and ID, ensuring cache consistency. Debug code was removed from the reassignment component. Changes
Sequence Diagram(s)sequenceDiagram
participant UI
participant TasksApi
participant Cache
UI->>TasksApi: updateTask({id, ...task})
TasksApi-->>UI: Returns updated TTask
UI->>Cache: Invalidate general tasks query
alt Assignee is TEAM
UI->>Cache: Invalidate tasks query by assignee ID
end
UI->>UI: Show success toast, close form
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
api/tasks/tasks.api.tsOops! Something went wrong! :( ESLint: 9.30.1 ESLint couldn't find the plugin "eslint-plugin-react-hooks". (The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-react-hooks" was referenced from the config file in " » eslint-config-next/core-web-vitals » /node_modules/.pnpm/eslint-config-next@15.3.5_eslint-plugin-import-x@4.16.1_@typescript-eslint+utils@8.36.0_79fa352f41e97200dfc66b7389b5a599/node_modules/eslint-config-next/index.js". If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting. components/reassign-user.tsxOops! Something went wrong! :( ESLint: 9.30.1 ESLint couldn't find the plugin "eslint-plugin-react-hooks". (The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-react-hooks" was referenced from the config file in " » eslint-config-next/core-web-vitals » /node_modules/.pnpm/eslint-config-next@15.3.5_eslint-plugin-import-x@4.16.1_@typescript-eslint+utils@8.36.0_79fa352f41e97200dfc66b7389b5a599/node_modules/eslint-config-next/index.js". If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting. components/edit-task-button.tsxOops! Something went wrong! :( ESLint: 9.30.1 ESLint couldn't find the plugin "eslint-plugin-react-hooks". (The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-react-hooks" was referenced from the config file in " » eslint-config-next/core-web-vitals » /node_modules/.pnpm/eslint-config-next@15.3.5_eslint-plugin-import-x@4.16.1_@typescript-eslint+utils@8.36.0_79fa352f41e97200dfc66b7389b5a599/node_modules/eslint-config-next/index.js". If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting.
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used🧠 Learnings (4)📓 Common learningscomponents/edit-task-button.tsx (1)api/tasks/tasks.api.ts (1)modules/dashboard/components/create-todo-button.tsx (1)🧬 Code Graph Analysis (3)components/reassign-user.tsx (1)
api/tasks/tasks.api.ts (2)
modules/dashboard/components/create-todo-button.tsx (1)
🔇 Additional comments (6)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
| Category | Issue | Status |
|---|---|---|
| Inefficient Query Invalidation Pattern ▹ view | ||
| Violation of Single Responsibility in mutation callback ▹ view |
Files scanned
| File Path | Reviewed |
|---|---|
| api/tasks/tasks.api.ts | ✅ |
| modules/dashboard/components/create-todo-button.tsx | ✅ |
| components/edit-task-button.tsx | ✅ |
| components/reassign-user.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.
Date: 19 July 2025
Developer Name: Yash Raj
Issue Ticket Number
Description
Description by Korbit AI
What change is being made?
Fix task invalidation when creating or editing a todo by returning the updated task object and adding additional query invalidations based on the assignee's user type.
Why are these changes being made?
The previous implementation did not return the updated task object after patching, which limited the ability to handle responses correctly. Adding query invalidations when a task's assignee is a team allows for updated task data to reflect dynamically across different contexts or views tied to team members, ensuring that the user interface remains consistent and accurate when tasks are updated or reassigned.