only query each client session once (#601)

this makes the ids unique so that they only get queried once
This commit is contained in:
Erik Jan de Wit 2021-05-17 15:35:12 +02:00 committed by GitHub
parent 07e6628040
commit 9fc96d0afc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -69,7 +69,7 @@ export const App = () => {
> >
<ErrorBoundary <ErrorBoundary
FallbackComponent={ErrorRenderer} FallbackComponent={ErrorRenderer}
onReset={window.location.reload} onReset={() => window.location.reload()}
> >
<Switch> <Switch>
{routes(() => {}).map((route, i) => ( {routes(() => {}).map((route, i) => (

View file

@ -33,11 +33,12 @@ export const SessionsSection = () => {
) )
).flat(); ).flat();
const userIds = Array.from(
new Set(clientSessions.map((session) => session.userId))
);
const userSessions = ( const userSessions = (
await Promise.all( await Promise.all(
clientSessions.map((session) => userIds.map((userId) => adminClient.users.listSessions({ id: userId! }))
adminClient.users.listSessions({ id: session.userId! })
)
) )
).flat(); ).flat();