Skip to content

Commit

Permalink
fix(MessageView): fix group order (#6760)
Browse files Browse the repository at this point in the history
Fixes #6750
  • Loading branch information
Lukas742 committed Dec 19, 2024
1 parent 86edabe commit 6c095de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.listItem {
min-height: 0;
height: var(--_ui5wcr-MessageViewListItemHeightSingle);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ const meta = {
groupName={'Employees'}
>
Informative message
</MessageItem>
</MessageItem>,
<MessageItem key={7} titleText={'Error Message Type'} type={ValueState.Negative} counter={3} />
]
}
} satisfies Meta<typeof MessageView>;
Expand Down
10 changes: 8 additions & 2 deletions packages/main/src/components/MessageView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,14 @@ export const resolveMessageGroups = (children: ReactElement<MessageItemPropTypes
return acc;
}, {});

return Object.entries<ReactElement<MessageItemPropTypes>[]>(groups).sort((a, b) => {
return a[0].localeCompare(b[0]);
return Object.entries<ReactElement<MessageItemPropTypes>[]>(groups).sort(([keyA], [keyB]) => {
if (keyA === '' && keyB !== '') {
return -1;
}
if (keyA !== '' && keyB === '') {
return 1;
}
return 0;
});
};

Expand Down

0 comments on commit 6c095de

Please sign in to comment.