From fe6d94b3098033261ae63f77fd9e4a99d9aaeaea Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Tue, 10 Sep 2024 18:48:37 -0500 Subject: [PATCH] re-render alerts table on comment setting update (#1085) Signed-off-by: Amardeepsingh Siglani Signed-off-by: AWSHurneyt --- .../flyouts/components/AlertsDashboardFlyoutComponent.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js b/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js index e639019b8..0a97b8c31 100644 --- a/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js +++ b/public/components/Flyout/flyouts/components/AlertsDashboardFlyoutComponent.js @@ -121,7 +121,7 @@ export default class AlertsDashboardFlyoutComponent extends Component { }); } - componentDidUpdate(prevProps, prevState) { + componentDidUpdate(_prevProps, prevState) { const prevQuery = getQueryObjectFromState(prevState); const currQuery = getQueryObjectFromState(this.state); if (!_.isEqual(prevQuery, currQuery)) { @@ -146,10 +146,11 @@ export default class AlertsDashboardFlyoutComponent extends Component { monitorIds ); } - const { monitorType } = this.state; + const { monitorType, commentsEnabled, tabId } = this.state; if ( - [MONITOR_TYPE.DOC_LEVEL, MONITOR_TYPE.COMPOSITE_LEVEL].includes(monitorType) && - !_.isEqual(prevState.selectedItems, this.state.selectedItems) + ([MONITOR_TYPE.DOC_LEVEL, MONITOR_TYPE.COMPOSITE_LEVEL].includes(monitorType) && + !_.isEqual(prevState.selectedItems, this.state.selectedItems)) || + (tabId === TABLE_TAB_IDS.ALERTS.id && commentsEnabled !== prevState.commentsEnabled) ) this.setState({ tabContent: this.renderAlertsTable() }); }