Skip to content

Paginate and memoize the list-heavy admin, social, and dashboard surfaces #1136

Description

@RUKAYAT-CODER

Background
Several high-traffic surfaces render an entire collection at once and rebuild child action handlers on every render, so they become slow and janky as data grows. src/components/ui/Table.tsx renders every row with no windowing and rebuilds per-row handlers; src/components/notificationcenter.tsx maps the full notification list; src/components/admin/ApprovalQueue.tsx maps all submissions and recreates its approve/reject handlers each render; src/components/BulkActions.tsx rebuilds operation callbacks; src/components/social/FollowingSystem.tsx and src/components/social/SocialProfile.tsx render full follower/activity lists; src/components/dashboard/AdvancedDashboard.tsx re-derives its panel grid each render; and src/components/cms/MediaManager.tsx maps the whole upload queue. Row/item components are not memoized and the callbacks passed to them are new references every render.

Implementation Plan

  • Add client-side pagination (or windowing, reusing the existing src/components/InfiniteList.tsx / react-window setup) to Table.tsx, notificationcenter.tsx, ApprovalQueue.tsx, MediaManager.tsx, FollowingSystem.tsx, and SocialProfile.tsx.
  • Extract row/item components and wrap them in React.memo, and stabilize the action callbacks (approve/reject, dismiss, select, remove, bulk ops) with useCallback in ApprovalQueue.tsx, notificationcenter.tsx, BulkActions.tsx, and Table.tsx.
  • Memoize derived/grouped data with useMemo in AdvancedDashboard.tsx and the feeds.
  • Add benchmarks/metrics capturing before/after render counts and timings.
  • Add regression tests where applicable.
  • Document the change.

Files in Scope (8)
src/components/ui/Table.tsx, src/components/notificationcenter.tsx, src/components/admin/ApprovalQueue.tsx, src/components/BulkActions.tsx, src/components/social/FollowingSystem.tsx, src/components/social/SocialProfile.tsx, src/components/dashboard/AdvancedDashboard.tsx, src/components/cms/MediaManager.tsx

Acceptance Criteria

  • Measurable performance/efficiency improvement demonstrated with before/after numbers
  • No regression in existing functionality
  • Tests pass and code follows project standards
  • Change is documented

Difficulty
Hard (Large)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions