fix(CQ-WEB-8): Add React.memo to performance-sensitive components
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:
Jason Woltje
2026-02-06 18:28:08 -06:00
parent 1005b7969c
commit 214139f4d5
7 changed files with 32 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
"use client";
import React from "react";
import type { Domain } from "@mosaic/shared";
interface DomainItemProps {
@@ -8,7 +9,11 @@ interface DomainItemProps {
onDelete?: (domain: Domain) => void;
}
export function DomainItem({ domain, onEdit, onDelete }: DomainItemProps): React.ReactElement {
export const DomainItem = React.memo(function DomainItem({
domain,
onEdit,
onDelete,
}: DomainItemProps): React.ReactElement {
return (
<div className="border rounded-lg p-4 hover:shadow-md transition-shadow">
<div className="flex items-start justify-between">
@@ -52,4 +57,4 @@ export function DomainItem({ domain, onEdit, onDelete }: DomainItemProps): React
</div>
</div>
);
}
});