diff --git a/apps/web/src/views/oss-friends/index.tsx b/apps/web/src/views/oss-friends/index.tsx index 9c95ffe9..e009cef2 100644 --- a/apps/web/src/views/oss-friends/index.tsx +++ b/apps/web/src/views/oss-friends/index.tsx @@ -18,6 +18,7 @@ interface OSSFriendsResponse { export default function OSSFriendsView() { const [ossFriends, setOSSFriends] = useState([]); + const [isLoading, setIsLoading] = useState(true); const fetchOSSFriends = async (): Promise => { try { const response = await fetch("/api/oss-friends"); @@ -36,8 +37,12 @@ export default function OSSFriendsView() { useEffect(() => { async function fetchData() { - const data = await fetchOSSFriends(); - setOSSFriends(data); + try { + const data = await fetchOSSFriends(); + setOSSFriends(data); + } finally { + setIsLoading(false); + } } void fetchData(); }, []); @@ -59,38 +64,54 @@ export default function OSSFriendsView() {
- {ossFriends.map((friend, idx) => { - return ( + {isLoading && + Array.from({ length: 12 }).map((_, idx) => (
-
- -

- {friend.name} -

- - -

- {friend.description} -

+
+
+
+
- +
- ); - })} + ))} + + {!isLoading && + ossFriends.map((friend, idx) => { + return ( +
+
+ +

+ {friend.name} +

+ + +

+ {friend.description} +

+
+ +
+ ); + })}