Consistent Sorting of Workspace Buttons Across Browsers (#3222)

Fixed inconsistent workspace order in different browers (#3217)
This commit is contained in:
Jeong Min Cho 2024-01-03 23:59:20 +09:00 committed by GitHub
parent 67fca68480
commit f4405b1b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,16 +17,16 @@ export const ObjectMetadataNavItems = () => {
.filter((item) =>
['person', 'company', 'opportunity'].includes(item.nameSingular),
)
.sort((objectMetadataItemA, _) => {
if (objectMetadataItemA.nameSingular === 'person') {
return -1;
.sort((objectMetadataItemA, objectMetadataItemB) => {
const order = ['person', 'company', 'opportunity'];
const indexA = order.indexOf(objectMetadataItemA.nameSingular);
const indexB = order.indexOf(objectMetadataItemB.nameSingular);
if (indexA === -1 || indexB === -1) {
return objectMetadataItemA.nameSingular.localeCompare(
objectMetadataItemB.nameSingular,
);
}
if (objectMetadataItemA.nameSingular === 'opportunity') {
return 1;
}
return 0;
return indexA - indexB;
}),
...activeObjectMetadataItems
.filter(