diff --git a/src/shared/layouts/CommonSidenavLayout/components/SidenavContent/components/ProjectsTree/hooks/useMenuItems.ts b/src/shared/layouts/CommonSidenavLayout/components/SidenavContent/components/ProjectsTree/hooks/useMenuItems.ts index 1eb5f92517..da65bfff9e 100644 --- a/src/shared/layouts/CommonSidenavLayout/components/SidenavContent/components/ProjectsTree/hooks/useMenuItems.ts +++ b/src/shared/layouts/CommonSidenavLayout/components/SidenavContent/components/ProjectsTree/hooks/useMenuItems.ts @@ -24,7 +24,16 @@ export const useMenuItems = (options: Options): MenuItem[] => { onCommonClick(stateItem.commonId); }, })) - .sort((item) => (item.id === activeStateItemId ? -1 : 1)) + .sort((prevItem, nextItem) => { + if (prevItem.id === activeStateItemId) { + return -1; + } + if (nextItem.id === activeStateItemId) { + return 1; + } + + return 0; + }) .concat({ id: CREATE_COMMON_ITEM_ID, text: "Create a common", diff --git a/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/components/FeedBreadcrumbsItem/FeedBreadcrumbsItem.tsx b/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/components/FeedBreadcrumbsItem/FeedBreadcrumbsItem.tsx index 50b81a54e4..e28802c99f 100644 --- a/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/components/FeedBreadcrumbsItem/FeedBreadcrumbsItem.tsx +++ b/src/shared/layouts/MultipleSpacesLayout/components/Header/components/Breadcrumbs/components/FeedItemBreadcrumbs/components/FeedBreadcrumbsItem/FeedBreadcrumbsItem.tsx @@ -52,9 +52,16 @@ const FeedBreadcrumbsItem: FC = (props) => { () => baseItems.length === 0 ? [activeItem] - : [...baseItems].sort((prevItem) => - prevItem.commonId === activeItem.commonId ? -1 : 1, - ), + : [...baseItems].sort((prevItem, nextItem) => { + if (prevItem.commonId === activeItem.commonId) { + return -1; + } + if (nextItem.commonId === activeItem.commonId) { + return 1; + } + + return 0; + }), [baseItems, activeItem], );