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 { Event } from "@mosaic/shared";
|
||||
import { formatTime } from "@/lib/utils/date-format";
|
||||
|
||||
@@ -5,7 +6,9 @@ interface EventCardProps {
|
||||
event: Event;
|
||||
}
|
||||
|
||||
export function EventCard({ event }: EventCardProps): React.JSX.Element {
|
||||
export const EventCard = React.memo(function EventCard({
|
||||
event,
|
||||
}: EventCardProps): React.JSX.Element {
|
||||
return (
|
||||
<div className="bg-white p-3 rounded-lg border-l-4 border-blue-500 shadow-sm hover:shadow-md transition-shadow">
|
||||
<div className="flex justify-between items-start mb-1">
|
||||
@@ -23,4 +26,4 @@ export function EventCard({ event }: EventCardProps): React.JSX.Element {
|
||||
{event.location && <p className="text-xs text-gray-500">📍 {event.location}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user