diff --git a/src/app.js b/src/app.js index 1e675d2d..0067c3f0 100644 --- a/src/app.js +++ b/src/app.js @@ -5555,12 +5555,9 @@ console.log(`isLinux: ${LINUX}`); await $app.feedTableLookup(); // eslint-disable-next-line require-atomic-updates $app.notificationTable.data = await database.getNotifications(); - await this.refreshNotifications(); - await $app.loadCurrentUserGroups( - args.json.id, - args.json?.presence?.groups - ); - await $app.getCurrentUserGroups(); + this.refreshNotifications(); + $app.loadCurrentUserGroups(args.json.id, args.json?.presence?.groups); + $app.getCurrentUserGroups(); try { if ( await configRepository.getBool(`friendLogInit_${args.json.id}`) diff --git a/src/classes/groups.js b/src/classes/groups.js index a58d02d0..4c31c86a 100644 --- a/src/classes/groups.js +++ b/src/classes/groups.js @@ -2084,27 +2084,29 @@ export default class extends baseClass { } if (groups) { - for (var i = 0; i < groups.length; i++) { - var groupId = groups[i]; - var groupRef = API.cachedGroups.get(groupId); + const promises = groups.map(async (groupId) => { + const groupRef = API.cachedGroups.get(groupId); + if ( typeof groupRef !== 'undefined' && groupRef.myMember?.roleIds?.length > 0 ) { - continue; + return; } try { - var args = await API.getGroup({ + const args = await API.getGroup({ groupId, includeRoles: true }); - var ref = API.applyGroup(args.json); + const ref = API.applyGroup(args.json); API.currentUserGroups.set(groupId, ref); } catch (err) { console.error(err); } - } + }); + + await Promise.allSettled(promises); } this.currentUserGroupsInit = true;