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 { Workspace } from "@mosaic/shared";
|
||||
import { WorkspaceMemberRole } from "@mosaic/shared";
|
||||
import Link from "next/link";
|
||||
@@ -22,7 +23,7 @@ const roleLabels: Record<WorkspaceMemberRole, string> = {
|
||||
[WorkspaceMemberRole.GUEST]: "Guest",
|
||||
};
|
||||
|
||||
export function WorkspaceCard({
|
||||
export const WorkspaceCard = React.memo(function WorkspaceCard({
|
||||
workspace,
|
||||
userRole,
|
||||
memberCount,
|
||||
@@ -58,4 +59,4 @@ export function WorkspaceCard({
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user