-
Notifications
You must be signed in to change notification settings - Fork 74
Fix/invitation data render #3907
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
- Refactored `TeamMembers`, `TeamMembersView`, and related components to improve performance through memoization and optimized data handling. - Updated type definitions for better type safety, replacing `IOrganizationTeamEmployee` with `TOrganizationTeamEmployee`. - Improved sorting and filtering logic for team members, ensuring efficient rendering and data management. - Enhanced UI components with consistent styling and improved accessibility. - Streamlined invitation handling in `useTeamInvitations` hook, integrating React Query for better state management and data fetching. - Added new types for user invitations to enhance security and performance.
- Refactored `UserProfileTask` to use `memo` for performance optimization. - Updated `TaskCard` to utilize `activeTeamState` for improved data handling and added memoization for `isTrackingEnabled`. - Enhanced component structure and styling for better readability and consistency. - Adjusted class names for improved layout and alignment across various elements.
- Refactored the logic for displaying empty messages based on the active filter in `TeamMembersBlockView`. - Replaced the switch statement with a memoized object to enhance readability and performance. - Improved code maintainability by consolidating message definitions into a single object.
- Introduced `useTimerButton` hook to manage task timer functionality, including starting and stopping timers based on task status. - Implemented loading state management and active task status tracking. - Enhanced team member updates when a timer is started, ensuring accurate task assignment and organization data handling. - Created new type definitions for task card interfaces to improve type safety and component integration.
- Updated class names and styles in `TeamMembersView`, `UserTeamCardSkeleton`, and `UserInviteCard` components for better layout and visual consistency. - Simplified flexbox properties to enhance alignment and spacing across various elements. - Adjusted padding and margin values to improve overall component appearance and responsiveness.
- Updated height classes from `h-[50px]` to `h-12` for consistency in `InputField`, `TimesheetSkeleton`, and other components. - Adjusted flexbox properties and class names in `TeamsDropDown`, `UserTeamCard`, and `TaskItem` for improved alignment and spacing. - Enhanced overall component styling for better visual coherence and responsiveness.
…performance - Replaced `TeamMember` interface with `TOrganizationTeamEmployee` for better type consistency across `TeamMembers` and related components. - Optimized sorting and filtering functions to utilize the new type, enhancing performance and readability. - Removed unused import of `useOrganizationTeams` in `task-card.tsx` to streamline dependencies.
WalkthroughThis set of changes primarily focuses on UI consistency, type safety, and performance optimizations. It standardizes Tailwind CSS class ordering and sizing across various components, introduces improved TypeScript typings, and memoizes several React components for better rendering efficiency. Some data-fetching and mutation logic is refactored to use React Query for improved state management. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TeamMembers
participant TeamMembersView
participant ViewComponent (Cards/Blocks/Table)
User->>TeamMembers: Render with props
TeamMembers->>TeamMembersView: Pass filtered/sorted members, view type
TeamMembersView->>ViewComponent: Render selected view with members
sequenceDiagram
participant Component
participant useTeamInvitations
participant ReactQuery
participant JotaiState
Component->>useTeamInvitations: Call hook
useTeamInvitations->>ReactQuery: Fetch invitations (tenant/org/team)
ReactQuery-->>useTeamInvitations: Return data
useTeamInvitations->>JotaiState: Sync invitations for backward compatibility
useTeamInvitations-->>Component: Return data, mutation functions
Component->>useTeamInvitations: Call mutation (invite/remove/resend)
useTeamInvitations->>ReactQuery: Mutate and invalidate queries
Possibly related PRs
Suggested labels
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
yarn install v1.22.22 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (8)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (6)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (5)
✨ Finishing Touches
🧪 Generate Unit Tests
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 (
|
Please review these files and clean up the unused code. |
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.
PR Summary
Major refactoring of team members and invitation handling components with focus on performance optimization and type safety improvements.
- Introduced new
useTimerButton
hook incore/hooks/tasks/use-timer-button.ts
for centralized timer management, though it needs improvements in error handling and setTimeout usage - Improved invitation handling with new interfaces in
core/types/interfaces/user/invite.ts
and better React Query integration inuseTeamInvitations
hook - Fixed critical TypeScript configuration issue in
tsconfig.json
where a file extension was incorrectly specified as '.tx' instead of '.ts' - Standardized component heights across the application from arbitrary
h-[50px]
to Tailwind'sh-12
for better design system consistency - Added proper TypeScript interface definitions in new
task-card.ts
for stronger type safety in task card components
25 files reviewed, 24 comments
Edit PR Review Bot Settings | Greptile
apps/web/core/components/pages/teams/team/team-members-views/user-team-card/user-info.tsx
Show resolved
Hide resolved
apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx
Show resolved
Hide resolved
...e/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx
Outdated
Show resolved
Hide resolved
...e/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx
Show resolved
Hide resolved
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: 7
🧹 Nitpick comments (4)
apps/web/core/hooks/tasks/use-timer-button.ts (2)
1-1
: Fix the incorrect file path in comment.The comment shows
core/hooks/task-card/useTimerButton.ts
but the actual file path iscore/hooks/tasks/use-timer-button.ts
.-// core/hooks/task-card/useTimerButton.ts +// core/hooks/tasks/use-timer-button.ts
47-47
: Explain the magic number timeout.The 100ms timeout needs explanation for why this delay is necessary.
- setTimeout(startTimer, 100); + // Small delay to ensure state updates are processed before starting timer + setTimeout(startTimer, 100);apps/web/core/hooks/organizations/teams/use-team-invitations.ts (1)
91-118
: Consider adding error handling for mutationsWhile the optimistic updates are good, consider adding
onError
handlers to revert changes when mutations fail:const inviteUserMutation = useMutation({ mutationFn: async (params: InviteUserParams) => { return await inviteService.inviteByEmails( { email: params.email, name: params.name, organizationId: params.organizationId, teamId: params.teamId }, params.tenantId ); }, onSuccess: (data) => { // Optimistic update of the cache const items = data.items || []; setTeamInvitations((prev) => [...prev, ...items]); // Invalidation of the cache for refetch queryClient.invalidateQueries({ queryKey: queryKeys.users.invitations.team( user?.tenantId || '', user?.employee?.organizationId || '', activeTeamId || '' ) }); - } + }, + onError: (error) => { + toast.error('Failed to send invitation', { + description: error.message + }); + // Consider reverting optimistic updates if needed + } });Also applies to: 120-154
apps/web/core/components/pages/teams/team/team-members.tsx (1)
48-52
: Minor optimization: Remove redundant nullish coalescingThe
?? 0
fallback is redundant sinceundefined
is already mapped to0
inTIMER_STATUS_PRIORITY
.-const sortByWorkStatus = (a: TOrganizationTeamEmployee, b: TOrganizationTeamEmployee): number => { - const priorityA = TIMER_STATUS_PRIORITY[a.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] ?? 0; - const priorityB = TIMER_STATUS_PRIORITY[b.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] ?? 0; - return priorityB - priorityA; -}; +const sortByWorkStatus = (a: TOrganizationTeamEmployee, b: TOrganizationTeamEmployee): number => { + const priorityA = TIMER_STATUS_PRIORITY[a.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] || 0; + const priorityB = TIMER_STATUS_PRIORITY[b.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] || 0; + return priorityB - priorityA; +};
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (26)
apps/web/app/[locale]/page-component.tsx
(2 hunks)apps/web/core/components/activities/timesheet-skeleton.tsx
(1 hunks)apps/web/core/components/duplicated-components/_input.tsx
(6 hunks)apps/web/core/components/duplicated-components/teams-dropdown.tsx
(7 hunks)apps/web/core/components/features/daily-plan/add-task-estimation-hours-modal.tsx
(1 hunks)apps/web/core/components/pages/profile/user-profile-tasks.tsx
(4 hunks)apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx
(1 hunks)apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx
(1 hunks)apps/web/core/components/pages/teams/team/team-members-views/team-members-header.tsx
(4 hunks)apps/web/core/components/pages/teams/team/team-members-views/user-team-card/index.tsx
(7 hunks)apps/web/core/components/pages/teams/team/team-members-views/user-team-card/user-info.tsx
(2 hunks)apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx
(1 hunks)apps/web/core/components/pages/teams/team/team-members.tsx
(2 hunks)apps/web/core/components/pages/timesheet/table-time-sheet.tsx
(1 hunks)apps/web/core/components/pages/timesheet/timesheet-card.tsx
(1 hunks)apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx
(4 hunks)apps/web/core/components/tasks/task-card.tsx
(16 hunks)apps/web/core/components/tasks/task-input.tsx
(6 hunks)apps/web/core/components/tasks/task-items.tsx
(6 hunks)apps/web/core/components/teams/invite/user-invite-card.tsx
(9 hunks)apps/web/core/components/teams/team-outstanding-notifications.tsx
(4 hunks)apps/web/core/hooks/organizations/teams/use-team-invitations.ts
(2 hunks)apps/web/core/hooks/tasks/use-timer-button.ts
(1 hunks)apps/web/core/types/interfaces/task/task-card.ts
(1 hunks)apps/web/core/types/interfaces/user/invite.ts
(1 hunks)apps/web/tsconfig.json
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/components/pages/timesheet/table-time-sheet.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/types/interfaces/user/invite.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/tasks/use-timer-button.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/duplicated-components/_input.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/components/teams/invite/user-invite-card.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/types/interfaces/task/task-card.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/tasks/task-card.tsx
[error] 1-1: Unused code detected in this file.
🪛 Biome (1.9.4)
apps/web/core/components/tasks/task-card.tsx
[error] 98-100: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (43)
apps/web/core/components/features/daily-plan/add-task-estimation-hours-modal.tsx (1)
708-708
: LGTM! Good consistency improvement.Replacing the arbitrary height value with Tailwind's standard utility class improves consistency across the codebase.
apps/web/app/[locale]/page-component.tsx (1)
73-73
: LGTM! CSS class ordering improvement.The reordering of Tailwind CSS classes enhances code consistency and maintainability without affecting functionality.
Also applies to: 79-79
apps/web/core/components/tasks/task-items.tsx (1)
51-51
: LGTM! Consistent CSS class ordering.The reordering of CSS classes throughout the component improves code consistency and readability without affecting functionality.
Also applies to: 76-76, 101-101, 145-145, 153-153, 168-169, 192-192
apps/web/core/components/teams/team-outstanding-notifications.tsx (1)
26-26
: LGTM! Improved spacing and CSS consistency.The spacing adjustments and CSS class reordering enhance the visual layout and maintain consistency with the broader styling improvements across the codebase.
Also applies to: 87-87, 95-95, 99-99, 194-194, 210-210
apps/web/core/components/duplicated-components/_input.tsx (3)
129-129
: Note the height reduction from 50px to 44px.The change from
h-[50px]
toh-11
reduces the input height by 6 pixels (50px → 44px). Ensure this height reduction aligns with your design system and doesn't negatively impact usability.
150-158
: Class reordering improves consistency.The Tailwind class reordering follows a consistent pattern and improves readability without affecting functionality.
219-226
: TimeInputField styling improvements look good.The class adjustments maintain the component's functionality while improving styling consistency.
apps/web/core/components/pages/timesheet/timesheet-card.tsx (1)
124-124
: Height standardization aligns with design system.The change from
h-[50px]
toh-12
(48px) maintains the accordion trigger's visual consistency while standardizing component heights across the application.apps/web/core/components/activities/timesheet-skeleton.tsx (1)
10-10
: Skeleton height standardization maintains consistency.The height change from
h-[50px]
toh-12
aligns the skeleton component with the standardized height system being implemented across the application.apps/web/core/components/pages/timesheet/table-time-sheet.tsx (1)
192-192
: AccordionTrigger height standardization improves consistency.The change from
h-[50px]
toh-12
standardizes the accordion trigger height with other timesheet components, maintaining visual consistency across the application.apps/web/core/components/pages/teams/team/team-members-views/user-team-card/user-info.tsx (1)
43-43
: Avatar container height standardization with aspect ratio consideration.The height changes from
h-[50px]
toh-12
(48px) standardize the component height while maintaining the 50px width. This creates a 50px × 48px container instead of square 50px × 50px. The minimal aspect ratio change should not significantly impact the avatar display.Also applies to: 55-55
apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx (2)
104-104
: LGTM! Consistent height class standardization.The replacement of
h-[50px]
withh-12
improves consistency with Tailwind's spacing scale. Note thath-12
equals 48px, which is a 2px reduction from the previous 50px height. This should be intentional for better visual harmony.Also applies to: 144-144, 275-275, 321-321
1-1
: I’ll verify each imported symbol’s actual usage (excluding its import statement):#!/bin/bash FILE="apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx" symbols=( Modal statusColor AnimatedEmptyState TimesheetCardDetail TranslationHooks useTranslations TimesheetDetailMode Accordion AccordionContent AccordionItem AccordionTrigger cn useTimesheet Badge EmployeeAvatar ProjectLogo groupBy TaskNameInfoDisplay TotalTimeDisplay ITimeLog ) for sym in "${symbols[@]}"; do echo "=== $sym ===" # Find all occurrences except the import line grep -n "$sym" "$FILE" | grep -v "^1:" || echo "No usage beyond import" doneapps/web/core/components/pages/teams/team/team-members-views/user-team-card/index.tsx (2)
111-111
: Verify the spacing change fromspace-x-2
togap-1
.The change from
space-x-2
(8px horizontal spacing) togap-1
(4px gap) alters both the spacing amount and behavior. Ensure this change maintains the intended visual layout.
172-172
: LGTM! CSS class reordering for consistency.The reordering of CSS classes improves code consistency without affecting the visual output or functionality.
Also applies to: 208-208, 215-215, 257-257, 278-278, 297-297, 311-311, 316-316
apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx (3)
10-11
: LGTM! Improved imports for type safety and performance.Adding
TOrganizationTeamEmployee
andmemo
imports supports the component's type safety and performance optimizations.
13-24
: Excellent type safety and performance improvements.Wrapping the component with
React.memo
prevents unnecessary re-renders, and replacingany
types withTOrganizationTeamEmployee
provides better type safety and developer experience.
27-68
: LGTM! Column definitions properly memoized.The
useMemo
for columns with an empty dependency array is appropriate since the column structure is static. This prevents recreating the columns array on every render.apps/web/core/types/interfaces/user/invite.ts (3)
69-72
: LGTM! Enhanced type safety for user invitations.The
InviteUserParams
interface properly extendsIInviteRequest
with the requiredtenantId
field, improving security and multi-tenancy support.
74-79
: LGTM! Well-structured interface for team invitation queries.The
TeamInvitationsQueryParams
interface provides clear typing for team invitation query parameters with all necessary fields.
1-1
: Address the pipeline failure regarding unused interfaces.The Knip analysis detected unused code. Verify that the new interfaces
InviteUserParams
andTeamInvitationsQueryParams
are properly imported and used in the codebase.#!/bin/bash # Description: Check usage of the new interfaces in the codebase # Expected: Find references to InviteUserParams and TeamInvitationsQueryParams echo "Checking usage of InviteUserParams:" rg -A 3 "InviteUserParams" --type ts echo -e "\nChecking usage of TeamInvitationsQueryParams:" rg -A 3 "TeamInvitationsQueryParams" --type tsapps/web/core/components/pages/profile/user-profile-tasks.tsx (3)
6-6
: LGTM! Added memo import for performance optimization.Including
memo
in the React imports enables the component memoization for better performance.
25-25
: Excellent performance optimization with React.memo.Converting the component to use
React.memo
prevents unnecessary re-renders when props haven't changed, improving performance. The component interface and functionality remain unchanged.Also applies to: 138-138
59-59
: LGTM! CSS class reordering for consistency.The minor reordering of CSS classes improves code consistency without affecting the visual output.
Also applies to: 64-64
apps/web/core/hooks/tasks/use-timer-button.ts (1)
1-60
: ```shell
#!/bin/bashDescription: Search for imports and invocations of useTimerButton across .ts and .tsx files
echo "Searching for useTimerButton imports and usages..."
rg -n "useTimerButton" --glob ".ts" --glob ".tsx"</details> <details> <summary>apps/web/core/components/pages/teams/team/team-members-views/team-members-header.tsx (1)</summary> `8-49`: **LGTM! Styling improvements enhance consistency.** The CSS class reorderings and height adjustments improve code consistency and follow Tailwind CSS best practices. The changes from fixed heights to Tailwind height utilities (`h-12`) are particularly good for maintainability. </details> <details> <summary>apps/web/core/components/duplicated-components/teams-dropdown.tsx (2)</summary> `10-10`: **Good addition of clsxm utility.** Adding the `clsxm` utility import enables better conditional className handling and is used appropriately in the component. --- `21-95`: **LGTM! Consistent styling improvements.** The CSS class reorderings, height standardization to Tailwind utilities, and proper use of `clsxm` for conditional classes improve code maintainability and consistency. </details> <details> <summary>apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx (3)</summary> `17-17`: **Excellent use of React.memo for performance optimization.** Converting the component to use `React.memo` will prevent unnecessary re-renders when props haven't changed, improving performance. --- `8-13`: **Good type consistency improvement.** Updating from generic interface types to the specific `TOrganizationTeamEmployee` schema type improves type safety and consistency across the codebase. --- `21-30`: **Clean refactor of empty message logic.** The refactor from a switch statement to a memoized object lookup is more readable and maintainable. The memoization prevents unnecessary re-creation of the object on each render. </details> <details> <summary>apps/web/core/components/teams/invite/user-invite-card.tsx (3)</summary> `205-205`: **Excellent safety improvement for email handling.** Adding null coalescing (`invitation.email ?? ''`) prevents potential runtime errors if the email property is undefined. This is a good defensive programming practice. --- `30-248`: **LGTM! Consistent styling improvements.** The CSS class reorderings, padding adjustments, and layout refinements improve visual consistency and code maintainability while preserving functionality. --- `1-275`: ```shell #!/bin/bash # Re-run usage search without file type filters echo "Searching for InvitedCard usages..." rg -w "InvitedCard" -A2 --glob "*.ts*" . echo "Searching for RemoveUserInviteMenu usages..." rg -w "RemoveUserInviteMenu" -A2 --glob "*.ts*" . echo "Searching for InviteUserTeamCard usages..." rg -w "InviteUserTeamCard" -A2 --glob "*.ts*" .
apps/web/core/types/interfaces/task/task-card.ts (1)
1-39
: ```shell
#!/bin/bash
echo "Searching for imports of FilterTabs, TaskCardGlobal, TaskCardProps in .ts/.tsx files..."
rg -g '.ts' -g '.tsx' "import.{.(FilterTabs|TaskCardGlobal|TaskCardProps).*from.*task-card"echo -e "\nSearching for any usage of FilterTabs outside task-card.ts..."
rg -g '.ts' -g '.tsx' "FilterTabs" --glob '!apps/web/core/types/interfaces/task/task-card.ts'echo -e "\nSearching for any usage of TaskCardGlobal outside task-card.ts..."
rg -g '.ts' -g '.tsx' "TaskCardGlobal" --glob '!apps/web/core/types/interfaces/task/task-card.ts'echo -e "\nSearching for any usage of TaskCardProps outside task-card.ts..."
rg -g '.ts' -g '.tsx' "TaskCardProps" --glob '!apps/web/core/types/interfaces/task/task-card.ts'</details> <details> <summary>apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx (1)</summary> `17-18`: **Good performance optimization with React.memo** The addition of `React.memo` wrapper is a good optimization that will prevent unnecessary re-renders when props haven't changed. </details> <details> <summary>apps/web/core/components/tasks/task-input.tsx (1)</summary> `346-346`: **CSS class reordering for consistency** These changes are purely cosmetic, reordering Tailwind CSS classes for better consistency across the codebase. Also applies to: 519-519, 670-670, 753-755, 793-793, 836-836, 851-851, 859-859, 867-867, 886-886, 917-918, 940-941 </details> <details> <summary>apps/web/core/components/tasks/task-card.tsx (1)</summary> `1-949`: ```bash #!/usr/bin/env bash set -e file="apps/web/core/components/tasks/task-card.tsx" # Extract exported function and component names exports=$(grep -E '^export (function|const|class) ' "$file" \ | sed -E 's/export (function|const|class) ([^ (:{]+).*/\2/') if [[ -z "$exports" ]]; then echo "No exports found in $file." exit 0 fi echo "Exports in $file:" echo "$exports" echo # Search for each export across the codebase (excluding the file itself) for name in $exports; do echo "References to '$name':" grep -R -n --include=\*.{ts,tsx} --exclude="$file" -e "\b$name\b" . echo done
apps/web/core/hooks/organizations/teams/use-team-invitations.ts (2)
21-301
: Excellent refactoring to React QueryThis refactoring significantly improves data fetching patterns by:
- Leveraging React Query's caching and synchronization
- Implementing proper optimistic updates
- Maintaining backward compatibility with Jotai state
The migration is well-structured and follows React Query best practices.
29-29
: We need to broaden our search to include both .ts and .tsx files without relying on ripgrep’s predefined types. Let’s retry with glob patterns:#!/bin/bash set -eo pipefail echo "Checking where activeTeamId cookie is set:" rg "setActiveTeamIdCookie" --glob "*.{ts,tsx}" echo -e "\nChecking other usages of getActiveTeamIdCookie:" rg "getActiveTeamIdCookie" --glob "*.{ts,tsx}" echo -e "\nChecking team switching logic:" rg "switchTeam|changeTeam|selectTeam" -A5 --glob "*.{ts,tsx}"apps/web/core/components/pages/teams/team/team-members.tsx (3)
11-34
: Excellent type safety improvements!The addition of
TeamMembersProps
andTeamMembersViewProps
interfaces significantly improves type safety and makes the component contracts more explicit. UsingTOrganizationTeamEmployee
instead of a generic interface is also a good practice.
69-101
: Excellent performance optimizations!The memoization strategy is well-thought-out:
- Processing members in a single pass with filtering, sorting, and current user identification
- Efficient filter conditions for block view members
- Proper dependency arrays for useMemo hooks
The comment about avoiding "useless memoization" for
isTeamsFetching
shows good judgment about when memoization is actually beneficial.
145-214
: Clean and maintainable implementation!The refactored
TeamMembersView
component demonstrates several best practices:
- Proper memoization of filtered members
- Configuration-based rendering eliminates switch statements
- Good defensive programming with fallback to CARDS view
- Clean separation of concerns between view selection and rendering
- Setting
displayName
for better debugging experience
apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx
Show resolved
Hide resolved
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.
Could you please check the suggestions made by the AI? @NdekoCode
Please review these files and clean up the unused code. |
Fix invitation data render
TeamMembers
,TeamMembersView
, and related components to improve performance through memoization and optimized data handling.IOrganizationTeamEmployee
withTOrganizationTeamEmployee
.useTeamInvitations
hook, integrating React Query for better state management and data fetching.UserProfileTask
to usememo
for performance optimization.IOrganizationTeamEmployee
withTOrganizationTeamEmployee
.TeamMembersBlockView
.useTimerButton
hook to manage task timer functionality, including starting and stopping timers based on task status.TeamMembersView
,UserTeamCardSkeleton
, andUserInviteCard
components for better layout and visual consistency.Type of Change
✅ Checklist
Please confirm you did the following before asking for review:
Summary by CodeRabbit
New Features
Refactor
Style
Bug Fixes
Chores