fix(CQ-WEB-8): Add React.memo to performance-sensitive components
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Wrap 7 list-item/card components with React.memo to prevent unnecessary re-renders when parent components update but props remain unchanged: - TaskItem (task lists) - EventCard (calendar views) - EntryCard (knowledge base) - WorkspaceCard (workspace list) - TeamCard (team list) - DomainItem (domain list) - ConnectionCard (federation connections) All are pure components rendered inside .map() loops that depend solely on their props for rendering output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import React from "react";
|
||||
import type { Team } from "@mosaic/shared";
|
||||
import { Card, CardHeader, CardContent } from "@mosaic/ui";
|
||||
import Link from "next/link";
|
||||
@@ -7,7 +8,10 @@ interface TeamCardProps {
|
||||
workspaceId: string;
|
||||
}
|
||||
|
||||
export function TeamCard({ team, workspaceId }: TeamCardProps): React.JSX.Element {
|
||||
export const TeamCard = React.memo(function TeamCard({
|
||||
team,
|
||||
workspaceId,
|
||||
}: TeamCardProps): React.JSX.Element {
|
||||
return (
|
||||
<Link href={`/settings/workspaces/${workspaceId}/teams/${team.id}`}>
|
||||
<Card className="hover:shadow-lg transition-shadow cursor-pointer">
|
||||
@@ -27,4 +31,4 @@ export function TeamCard({ team, workspaceId }: TeamCardProps): React.JSX.Elemen
|
||||
</Card>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user