From 5d329b8dfa33c615d713eb461cee7118f9be4f5e Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Sun, 30 Nov 2025 18:22:12 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Improve=20loading=20experie?= =?UTF-8?q?nce=20in=20FavoritesList=20by=20adding=20skeleton=20placeholder?= =?UTF-8?q?s=20for=20favorites=20and=20marketplace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Nav/Favorites/FavoritesList.tsx | 73 +++++++++++++------ 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/client/src/components/Nav/Favorites/FavoritesList.tsx b/client/src/components/Nav/Favorites/FavoritesList.tsx index 05b1de174..0098c22d1 100644 --- a/client/src/components/Nav/Favorites/FavoritesList.tsx +++ b/client/src/components/Nav/Favorites/FavoritesList.tsx @@ -18,6 +18,14 @@ const FavoriteItemSkeleton = () => ( ); +/** Skeleton placeholder for the Agent Marketplace button while loading */ +const MarketplaceSkeleton = () => ( +
+ + +
+); + interface DraggableFavoriteItemProps { id: string; index: number; @@ -206,38 +214,55 @@ export default function FavoritesList({ draggedFavoritesRef.current = favorites; }, [favorites]); - // Show nothing while favorites are loading to prevent layout shifts - if (isFavoritesLoading) { + // If no favorites and no marketplace to show, and not loading, return null + if (!isFavoritesLoading && favorites.length === 0 && !showAgentMarketplace) { return null; } - // If no favorites and no marketplace to show, return null - if (favorites.length === 0 && !showAgentMarketplace) { - return null; + // While favorites are initially loading, show a minimal placeholder + // This prevents the "null to content" jump + if (isFavoritesLoading) { + return ( +
+
+ {showAgentMarketplace && } + +
+
+ ); } return (
- {/* Agent Marketplace button */} - {showAgentMarketplace && ( -
-
-
- -
- {localize('com_agents_marketplace')} -
-
- )} {/* Show skeletons for ALL items while agents are still loading */} - {isAgentsLoading - ? favorites.map((fav, index) => ) - : favorites.map((fav, index) => { + {isAgentsLoading ? ( + <> + {/* Marketplace skeleton */} + {showAgentMarketplace && } + {/* Favorite items skeletons */} + {favorites.map((_, index) => ( + + ))} + + ) : ( + <> + {/* Agent Marketplace button */} + {showAgentMarketplace && ( +
+
+
+ +
+ {localize('com_agents_marketplace')} +
+
+ )} + {favorites.map((fav, index) => { if (fav.agentId) { const agent = agentsMap[fav.agentId]; if (!agent) { @@ -272,6 +297,8 @@ export default function FavoritesList({ } return null; })} + + )}
);