Skip to content

Commit 82e07be

Browse files
authored
MGMT-16970: BMH status not updated in console during provisioning phase [BACKPORT 2.10] (#2514)
* Fix BMH status in table * Memoize BMH and agent statuses
1 parent 23d6e7b commit 82e07be

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: libs/ui-lib/lib/cim/components/InfraEnv/InfraEnvAgentTable.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
108108
},
109109
);
110110
const { t } = useTranslation();
111-
const agentStatuses = agentStatus(t);
112-
const bmhStatuses = bmhStatus(t);
111+
const { agentStatuses, bmhStatuses } = React.useMemo(
112+
() => ({
113+
agentStatuses: agentStatus(t),
114+
bmhStatuses: bmhStatus(t),
115+
}),
116+
[t],
117+
);
118+
113119
const {
114120
statusCount,
115121
hostnameFilter,
@@ -142,6 +148,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
142148
agents,
143149
agentStatuses,
144150
bareMetalHosts,
151+
bmhStatuses,
145152
onEditHostname: onEditHost,
146153
onApprove: onApprove,
147154
t,
@@ -161,6 +168,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
161168
hostActions.canEditHostname,
162169
hostActions.canEditBMH,
163170
agentStatuses,
171+
bmhStatuses,
164172
onEditHost,
165173
onApprove,
166174
agentMachines,

0 commit comments

Comments
 (0)