Skip to content

Commit

Permalink
filter out dupe error messages (#3927)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshri authored Aug 9, 2023
1 parent aeb5daa commit c147a72
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ui/components/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Alert from "./Alert";
import Breadcrumbs, { Breadcrumb } from "./Breadcrumbs";
import Flex from "./Flex";
import LoadingPage from "./LoadingPage";
import Spacer from "./Spacer";
import UserSettings from "./UserSettings";

export type PageProps = {
Expand Down Expand Up @@ -59,17 +58,15 @@ const TopToolBar = styled(Flex)`
`;

export function Errors({ error }) {
const arr = _.isArray(error) ? error : [error];
const arr = _.isArray(error) ? _.uniqBy(error, (e) => e?.message) : [error];
if (arr[0])
return (
<Flex wide column>
<Spacer padding="xs" />
<Flex wide column gap="4">
{_.map(arr, (e, i) => (
<Flex key={i} wide start>
<Alert title="Error" message={e?.message} severity="error" />
</Flex>
))}
<Spacer padding="xs" />
</Flex>
);
return null;
Expand Down

0 comments on commit c147a72

Please sign in to comment.