Actions
dev #2828
open
Actions
dev #2794: [Module] Sprint 11
Added by Najmul Hasan 8 months ago. Updated 8 months ago.
Memoized the fetchData function using useMemo to prevent unnecessary re-creations and API calls.
Added error handling with a fallback to empty data (setData([])) to ensure rendering continues on failures.
Simplified useEffect to depend only on the memoized fetchData.
In AuthorVerified.tsx (for both issues):
Removed conditional rendering around the dropdown content; now always renders the list but controls visibility with CSS (max-h-96 opacity-100 visible vs. max-h-0 opacity-0 invisible overflow-hidden).
Improved keys in map loops for stability (using userId or userName fallback).
Retained Image and Link for consistency with Next.js optimizations.
Close on Outside Click:
Added useRef to reference the dropdown container.
Added useEffect to listen for mousedown events on the document, closing the dropdown if the click is outside the ref.