Skip to content

Commit 41872af

Browse files
authored
MGMT-16970: BMH status not updated in console during provisioning phase (#2507)
* Fix BMH status in table * Memoize BMH and agent statuses
1 parent af258b2 commit 41872af

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

libs/ui-lib/lib/cim/components/InfraEnv/InfraEnvAgentTable.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,14 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
109109
},
110110
);
111111
const { t } = useTranslation();
112-
const agentStatuses = agentStatus(t);
113-
const bmhStatuses = bmhStatus(t);
112+
const { agentStatuses, bmhStatuses } = React.useMemo(
113+
() => ({
114+
agentStatuses: agentStatus(t),
115+
bmhStatuses: bmhStatus(t),
116+
}),
117+
[t],
118+
);
119+
114120
const {
115121
statusCount,
116122
hostnameFilter,
@@ -143,6 +149,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
143149
agents,
144150
agentStatuses,
145151
bareMetalHosts,
152+
bmhStatuses,
146153
onEditHostname: onEditHost,
147154
onApprove: onApprove,
148155
t,
@@ -162,6 +169,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
162169
hostActions.canEditHostname,
163170
hostActions.canEditBMH,
164171
agentStatuses,
172+
bmhStatuses,
165173
onEditHost,
166174
onApprove,
167175
agentMachines,

0 commit comments

Comments
 (0)