From aed87399c0a2d9062ef086ea3c95bf18e36bacea Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 4 Sep 2020 15:07:06 +0300 Subject: [PATCH] Members: fetch members in chunks. --- src/Collections/CollectionMembers.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Collections/CollectionMembers.tsx b/src/Collections/CollectionMembers.tsx index 735c43f..a839700 100644 --- a/src/Collections/CollectionMembers.tsx +++ b/src/Collections/CollectionMembers.tsx @@ -39,8 +39,20 @@ export default function CollectionMembers(props: PropsType) { const colMgr = getCollectionManager(etebase); const memberManager = colMgr.getMemberManager(collection); try { - const members = await memberManager.list(); - setMembers(members.data); + const ret: Etebase.CollectionMember[] = []; + let iterator: string | null = null; + let done = false; + while (!done) { + // FIXME: shouldn't be any + const members: any = await memberManager.list({ iterator, limit: 30 }); + iterator = members.iterator; + done = members.done; + + for (const member of members.data) { + ret.push(member); + } + } + setMembers(ret); } catch (e) { setError(e); }