Skip to content

Commit a1cbc9b

Browse files
committed
avoid loop
1 parent 9a523da commit a1cbc9b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

web/src/components/netflow-traffic.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,11 @@ export const NetflowTraffic: React.FC<NetflowTrafficProps> = ({
455455
})
456456
.catch(err => {
457457
const errStr = getHTTPErrorDetails(err, true);
458+
const promErrStr = getPromError(errStr);
458459

459-
// check if it's a prom missing label error
460-
if (isPromMissingLabelError(errStr)) {
460+
// check if it's a prom missing label error and remove filters
461+
// when the prom error is different to the new one
462+
if (isPromMissingLabelError(errStr) && promErrStr !== model.chipsPopoverMessage) {
461463
let filtersDisabled = false;
462464
model.filters.list.forEach(filter => {
463465
const fieldName = model.config.columns.find(col => col.filter === filter.def.id)?.field;
@@ -471,16 +473,18 @@ export const NetflowTraffic: React.FC<NetflowTrafficProps> = ({
471473
if (filtersDisabled) {
472474
// update filters to retrigger query without showing the error
473475
updateTableFilters({ ...model.filters });
474-
model.setChipsPopoverMessage(getPromError(errStr));
476+
model.setChipsPopoverMessage(promErrStr);
475477
return;
476478
}
477479
}
478480

479481
// clear flows and metrics + show error
482+
// always clear chip message to focus on the error
480483
model.setFlows([]);
481484
model.setMetrics(defaultNetflowMetrics);
482485
model.setError(errStr);
483486
model.setWarning(undefined);
487+
model.setChipsPopoverMessage(undefined);
484488
})
485489
.finally(() => {
486490
const endDate = new Date();

0 commit comments

Comments
 (0)