Skip to content

Commit 26d003c

Browse files
authored
fix(inspect): Fix model view failing after training (#3143)
fix(inspect): stop model table selection loop after training Signed-off-by: Dmitry Kalinin <dmitry.kalinin@intel.com>
1 parent c46946f commit 26d003c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

application/ui/src/features/inspect/models/models-view.component.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useMemo } from 'react';
2+
13
import { $api } from '@geti-inspect/api';
24
import { useProjectIdentifier } from '@geti-inspect/hooks';
35
import {
@@ -100,6 +102,14 @@ export const ModelsView = () => {
100102

101103
const { selectedModelId, onSetSelectedModelId } = useInference();
102104

105+
const tableSelectedKeys = useMemo(() => {
106+
if (selectedModelId === undefined) {
107+
return new Set<string>();
108+
}
109+
110+
return new Set<string>([selectedModelId]);
111+
}, [selectedModelId]);
112+
103113
return (
104114
<View backgroundColor='gray-100' height='100%'>
105115
{/* Models Table */}
@@ -108,13 +118,16 @@ export const ModelsView = () => {
108118
overflowMode='wrap'
109119
selectionStyle='highlight'
110120
selectionMode='single'
111-
selectedKeys={selectedModelId === undefined ? new Set() : new Set([selectedModelId])}
121+
selectedKeys={tableSelectedKeys}
112122
onSelectionChange={(key) => {
113123
if (typeof key === 'string') {
114124
return;
115125
}
116126

117127
const selectedId = key.values().next().value;
128+
if (selectedId === selectedModelId) {
129+
return;
130+
}
118131
const selectedModel = models.find((model) => model.id === selectedId);
119132

120133
if (selectedModel?.status === 'Completed') {

0 commit comments

Comments
 (0)