Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Sep 19, 2023
1 parent d2132f8 commit ee7aacc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/libs/ErrorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ type OnyxDataWithErrors = {
};

function getLatestErrorMessage<TOnyxData extends OnyxDataWithErrors>(onyxData: TOnyxData): string {
if (Object.keys(onyxData.errors).length === 0) {
const errors = onyxData.errors ?? {};

if (Object.keys(errors).length === 0) {
return '';
}

const key = Object.keys(onyxData.errors ?? {})
.sort()
.reverse()[0];
const key = Object.keys(errors).sort().reverse()[0];

return onyxData.errors[key];
return errors[key];
}

type OnyxDataWithErrorFields = {
Expand Down

0 comments on commit ee7aacc

Please sign in to comment.