diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx
index 2699ab38a890e..6be3b861ef9f7 100644
--- a/src/webviews/apps/plus/graph/GraphWrapper.tsx
+++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx
@@ -98,21 +98,10 @@ import { GitActionsButtons } from './actions/gitActionsButtons';
import { GlGraphHover } from './hover/graphHover.react';
import type { GraphMinimapDaySelectedEventDetail } from './minimap/minimap';
import { GlGraphMinimapContainer } from './minimap/minimap-container.react';
+import { compareGraphRefOpts } from './refHelpers/compareGraphRefOpts';
+import { RemoteIcon } from './refHelpers/RemoteIcon';
import { GlGraphSideBar } from './sidebar/sidebar.react';
-function getRemoteIcon(type: string | number) {
- switch (type) {
- case 'head':
- return 'vm';
- case 'remote':
- return 'cloud';
- case 'tag':
- return 'tag';
- default:
- return '';
- }
-}
-
export interface GraphWrapperProps {
nonce?: string;
state: State;
@@ -1406,33 +1395,39 @@ export function GraphWrapper({
Hidden Branches / Tags
{excludeRefsById &&
Object.keys(excludeRefsById).length &&
- [...Object.values(excludeRefsById), null].map(ref =>
- ref ? (
-
- ) : (
- // One more weird case. If I render it outside the listed items, the dropdown is hidden after click on the last item
-
- ),
- )}
+ (
+ Object.values(excludeRefsById)
+ .slice()
+ .sort(compareGraphRefOpts) as Array
+ )
+ .concat(null)
+ .map(ref =>
+ ref ? (
+
+ ) : (
+ // One more weird case. If I render it outside the listed items, the dropdown is hidden after click on the last item
+
+ ),
+ )}
diff --git a/src/webviews/apps/plus/graph/refHelpers/RemoteIcon.tsx b/src/webviews/apps/plus/graph/refHelpers/RemoteIcon.tsx
new file mode 100644
index 0000000000000..d278c137a801b
--- /dev/null
+++ b/src/webviews/apps/plus/graph/refHelpers/RemoteIcon.tsx
@@ -0,0 +1,25 @@
+import type { GraphRefOptData } from '@gitkraken/gitkraken-components';
+import React from 'react';
+import { CodeIcon } from '../../../shared/components/code-icon.react';
+
+// eslint-disable-next-line @typescript-eslint/naming-convention
+export function RemoteIcon({ refOptData }: Readonly<{ refOptData: GraphRefOptData }>) {
+ if (refOptData.avatarUrl) {
+ return
;
+ }
+ let icon = '';
+ switch (refOptData.type) {
+ case 'head':
+ icon = 'vm';
+ break;
+ case 'remote':
+ icon = 'cloud';
+ break;
+ case 'tag':
+ icon = 'tag';
+ break;
+ default:
+ break;
+ }
+ return ;
+}
diff --git a/src/webviews/apps/plus/graph/refHelpers/compareGraphRefOpts.ts b/src/webviews/apps/plus/graph/refHelpers/compareGraphRefOpts.ts
new file mode 100644
index 0000000000000..352371bd87432
--- /dev/null
+++ b/src/webviews/apps/plus/graph/refHelpers/compareGraphRefOpts.ts
@@ -0,0 +1,13 @@
+import type { GraphRefOptData } from '@gitkraken/gitkraken-components';
+
+// copied from GitkrakenComponents to keep refs order the same as in the graph
+export function compareGraphRefOpts(a: GraphRefOptData, b: GraphRefOptData): number {
+ const comparationResult = a.name.localeCompare(b.name);
+ if (comparationResult === 0) {
+ // If names are equals
+ if (a.type === 'remote') {
+ return -1;
+ }
+ }
+ return comparationResult;
+}