perf(frontend): Optimize component rendering with React.memo and hooks - Sprint 3 Story 2
Add React.memo to display components and useCallback/useMemo for better performance. Changes: - Added React.memo to TaskCard component - Added React.memo to StoryCard component - Added React.memo to KanbanBoard component - Added React.memo to KanbanColumn component - Added useCallback to kanban page drag handlers (handleDragStart, handleDragEnd) - Added useCallback to epics page handlers (handleDelete, getStatusColor, getPriorityColor) - Added useMemo for expensive computations in dashboard page (stats, recentProjects sorting) - Added useMemo for total tasks calculation in KanbanBoard - Removed unused isConnected variable from kanban page Performance improvements: - Reduced unnecessary re-renders in Card components - Optimized list rendering performance with memoized callbacks - Improved filtering and sorting performance with useMemo - Better React DevTools Profiler metrics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { Card, CardContent, CardHeader } from '@/components/ui/card';
|
||||
import { Clock, User } from 'lucide-react';
|
||||
import type { TaskCard as TaskCardType } from '@/types/kanban';
|
||||
@@ -9,7 +10,7 @@ interface TaskCardProps {
|
||||
isDragging?: boolean;
|
||||
}
|
||||
|
||||
export function TaskCard({ task, isDragging = false }: TaskCardProps) {
|
||||
export const TaskCard = React.memo(function TaskCard({ task, isDragging = false }: TaskCardProps) {
|
||||
const priorityColors = {
|
||||
Low: 'bg-blue-100 text-blue-700',
|
||||
Medium: 'bg-yellow-100 text-yellow-700',
|
||||
@@ -59,4 +60,4 @@ export function TaskCard({ task, isDragging = false }: TaskCardProps) {
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user