Skip to content

Commit

Permalink
sort 'new' apps to the end of the list
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 committed Feb 12, 2025
1 parent 7541f78 commit c1c6f43
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/MainNav/AppOrderProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,17 @@ export const AppOrderProvider = ({ children }) => { // eslint-disable-line react

// sort the platformApps according to the preference.
navList = platformApps.sort((a, b) => {
return orderedApps.findIndex(({ name }) => a.name === name) -
orderedApps.findIndex(({ name }) => b.name === name);
const aIndex = orderedApps.findIndex(({ name }) => a.name === name);
const bIndex = orderedApps.findIndex(({ name }) => b.name === name);

if (bIndex === -1) {
return -1;
}

if (aIndex === -1) {
return 1;
}
return aIndex - bIndex;
});

// find the apps from the platform that are not saved in user-reordered list and tack them on at the end.
Expand Down

0 comments on commit c1c6f43

Please sign in to comment.