File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -151,8 +151,17 @@ export const AppOrderProvider = ({ children }) => { // eslint-disable-line react
151
151
152
152
// sort the platformApps according to the preference.
153
153
navList = platformApps . sort ( ( a , b ) => {
154
- return orderedApps . findIndex ( ( { name } ) => a . name === name ) -
155
- orderedApps . findIndex ( ( { name } ) => b . name === name ) ;
154
+ const aIndex = orderedApps . findIndex ( ( { name } ) => a . name === name ) ;
155
+ const bIndex = orderedApps . findIndex ( ( { name } ) => b . name === name ) ;
156
+
157
+ if ( bIndex === - 1 ) {
158
+ return - 1 ;
159
+ }
160
+
161
+ if ( aIndex === - 1 ) {
162
+ return 1 ;
163
+ }
164
+ return aIndex - bIndex ;
156
165
} ) ;
157
166
158
167
// find the apps from the platform that are not saved in user-reordered list and tack them on at the end.
You can’t perform that action at this time.
0 commit comments