-
Notifications
You must be signed in to change notification settings - Fork 14
refactor(#222): enhance user and team search functionality #223
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
Conversation
…y with improved filtering and loading states
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Summary by CodeRabbit
WalkthroughThe user-and-team-search component was refactored to conditionally fetch data based on route scope: team-specific data when in team context, or all teams when not. Helper utilities were added for data transformation and filtering. Options computation was consolidated into a single useMemo hook with unified rendering logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this 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 |
|---|---|---|
| Redundant Type Assertion ▹ view | ✅ Fix detected | |
| Missing loading state for userTeams query ▹ view | ✅ Fix detected |
Files scanned
| File Path | Reviewed |
|---|---|
| src/components/users/user-and-team-search.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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
src/components/users/user-and-team-search.tsx(4 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
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.
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#189
File: modules/teams/components/teams-layout-header.tsx:44-51
Timestamp: 2025-08-26T07:14:25.788Z
Learning: In the todo-frontend application, teams are only visible to people who are part of the team. Non-members cannot access team pages, so membership checks in components like teams-layout-header are unnecessary since access control is handled at a higher level.
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#189
File: modules/teams/team-members.tsx:63-63
Timestamp: 2025-08-26T08:14:08.375Z
Learning: In modules/teams/team-members.tsx, the LeaveTeamDialog components use a shared boolean state (showLeaveTeamDialog) which causes all dialog instances across all rows to open simultaneously when any "Remove from team" option is clicked. This requires per-row state management using selectedMemberId to track which specific member's dialog should be open.
📚 Learning: 2025-08-26T08:14:08.375Z
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#189
File: modules/teams/team-members.tsx:63-63
Timestamp: 2025-08-26T08:14:08.375Z
Learning: In modules/teams/team-members.tsx, the LeaveTeamDialog components use a shared boolean state (showLeaveTeamDialog) which causes all dialog instances across all rows to open simultaneously when any "Remove from team" option is clicked. This requires per-row state management using selectedMemberId to track which specific member's dialog should be open.
Applied to files:
src/components/users/user-and-team-search.tsx
📚 Learning: 2025-08-26T07:14:25.788Z
Learnt from: Hariom01010
PR: Real-Dev-Squad/todo-frontend#189
File: modules/teams/components/teams-layout-header.tsx:44-51
Timestamp: 2025-08-26T07:14:25.788Z
Learning: In the todo-frontend application, teams are only visible to people who are part of the team. Non-members cannot access team pages, so membership checks in components like teams-layout-header are unnecessary since access control is handled at a higher level.
Applied to files:
src/components/users/user-and-team-search.tsx
📚 Learning: 2025-10-21T10:29:32.489Z
Learnt from: AnujChhikara
PR: Real-Dev-Squad/todo-frontend#218
File: src/api/teams/teams.type.ts:119-122
Timestamp: 2025-10-21T10:29:32.489Z
Learning: In the todo-frontend repository's activity logging system (src/api/teams/teams.type.ts), avoid suggesting additional fields for activity types as the team is aware the current approach of adding fields per activity type isn't scalable and plans to redesign the logging architecture in v1 development.
Applied to files:
src/components/users/user-and-team-search.tsx
🧬 Code graph analysis (1)
src/components/users/user-and-team-search.tsx (2)
src/hooks/useAuth.ts (1)
useAuth(13-36)src/api/teams/teams.api.ts (1)
TeamsApi(16-116)
🪛 ESLint
src/components/users/user-and-team-search.tsx
[error] 4-4: Unable to resolve path to module '@tanstack/react-query'.
(import-x/no-unresolved)
[error] 5-5: Unable to resolve path to module '@tanstack/react-router'.
(import-x/no-unresolved)
[error] 6-6: Unable to resolve path to module 'lucide-react'.
(import-x/no-unresolved)
Deploying todo-frontend with
|
| Latest commit: |
5110d43
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4f7e54f3.todo-frontend-76p.pages.dev |
| Branch Preview URL: | https://anuj-refactor-assignee-logic.todo-frontend-76p.pages.dev |
…e sorting logic for user and team search
…ding braces around conditional statement
…separate functions for improved readability and maintainability
… and consistency in option handling
* feat(user-and-team-search): enhance user and team search functionality with improved filtering and loading states * fix(user-and-team-search): improve loading state handling for user teams * refactor(user-and-team-search): simplify option generation and improve sorting logic for user and team search * style(user-and-team-search): format code for better readability by adding braces around conditional statement * refactor(user-and-team-search): extract option generation logic into separate functions for improved readability and maintainability * refactor(user-and-team-search): rename filtering function for clarity and consistency in option handling
Date: 30 Oct 2025
Developer Name: @AnujChhikara
Issue Ticket Number
Description
Updated the assignee selection logic based on the task scope.
New behavior:
Team Dashboard: When creating a task under a team, the assignee options will include only that team and its members.
Personal Dashboard: When creating a personal task, the scope will be set to personal, and the assignee options will include only yourself and the teams you are part of.
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Screen.Recording.2025-10-30.at.2.07.37.AM.mov
Test Coverage
Screenshot 1
Additional Notes
Description by Korbit AI
What change is being made?
Refactor the user-and-team search component to support both global and team-scoped searches by:
Why are these changes being made?
Enable accurate, context-aware search (global users + teams or a specific team’s members) with better performance and a cleaner data flow, while aligning placeholders and UI behavior to reflect the current scope.