Skip to content

Commit

Permalink
Don't query batch on empty set of users (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
chennisden authored Jun 17, 2024
1 parent f00e504 commit a058595
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/src/pages/Parts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const Parts = () => {
partsQuery.forEach((part) => {
ids.add(part.owner);
});
setIdMap(await auth_api.getUserBatch(Array.from(ids)));
if (ids.size > 0)
setIdMap(await auth_api.getUserBatch(Array.from(ids)));
} catch (err) {
if (err instanceof Error) {
setError(err.message);
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/Robots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const Robots = () => {
robotsQuery.forEach((robot) => {
ids.add(robot.owner);
});
setIdMap(await auth_api.getUserBatch(Array.from(ids)));
if (ids.size > 0)
setIdMap(await auth_api.getUserBatch(Array.from(ids)));
} catch (err) {
if (err instanceof Error) {
addAlert(err.message, "error");
Expand Down

0 comments on commit a058595

Please sign in to comment.