Refactor profile loading effect

cgen-add78cac0b7f4d31b999c96257319858
This commit is contained in:
Builder.io 2025-10-14 02:24:11 +00:00
parent ba170e72f8
commit 57db40e7b3

View file

@ -89,17 +89,21 @@ export default function Admin() {
const [applicationsLoading, setApplicationsLoading] = useState(false); const [applicationsLoading, setApplicationsLoading] = useState(false);
const [selectedMemberId, setSelectedMemberId] = useState<string | null>(null); const [selectedMemberId, setSelectedMemberId] = useState<string | null>(null);
useEffect(() => { const loadProfiles = useCallback(async () => {
(async () => { try {
try { const list = await aethexUserService.listProfiles(200);
const list = await aethexUserService.listProfiles(50); setManagedProfiles(list);
setManagedProfiles(list); } catch (error) {
} catch (error) { console.warn("Failed to load managed profiles:", error);
console.warn("Failed to load managed profiles:", error); setManagedProfiles([]);
setManagedProfiles([]); }
} }, []);
})();
useEffect(() => {
loadProfiles().catch(() => undefined);
}, [loadProfiles]);
useEffect(() => {
fetch("/api/featured-studios") fetch("/api/featured-studios")
.then((r) => (r.ok ? r.json() : [])) .then((r) => (r.ok ? r.json() : []))
.then((data) => { .then((data) => {