diff --git a/public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx b/public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx index 0201bec3161..9efe62efaf4 100644 --- a/public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleActionsButtons.tsx @@ -7,7 +7,6 @@ import { useDeleteModal } from 'app/features/alerting/unified/components/rule-vi import { INSTANCES_DISPLAY_LIMIT } from 'app/features/alerting/unified/components/rules/RuleDetails'; import SilenceGrafanaRuleDrawer from 'app/features/alerting/unified/components/silences/SilenceGrafanaRuleDrawer'; import { useRulesFilter } from 'app/features/alerting/unified/hooks/useFilteredRules'; -import { AlertmanagerProvider } from 'app/features/alerting/unified/state/AlertmanagerContext'; import { useDispatch } from 'app/types'; import { CombinedRule, RuleIdentifier, RulesSource } from 'app/types/unified-alerting'; @@ -126,9 +125,7 @@ export const RuleActionsButtons = ({ compact, showViewButton, rule, rulesSource /> {deleteModal} {isGrafanaAlertingRule(rule.rulerRule) && showSilenceDrawer && ( - - setShowSilenceDrawer(false)} /> - + setShowSilenceDrawer(false)} /> )} {redirectToClone?.identifier && ( void; @@ -12,29 +15,33 @@ type Props = { /** * For a given Grafana managed rule, renders a drawer containing silences editor and Alertmanager selection */ -const SilenceGrafanaRuleDrawer = ({ rulerRule, onClose }: Props) => { - const { uid } = rulerRule.grafana_alert; +const SilenceGrafanaRuleDrawer = React.memo( + ({ rulerRule, onClose }: Props) => { + const { uid } = rulerRule.grafana_alert; - const formValues = getDefaultSilenceFormValues(); - - return ( - - - - - - ); -}; + return ( + + + + + + + + ); + }, + (prevProps, nextProps) => { + return prevProps.rulerRule.grafana_alert.uid === nextProps.rulerRule.grafana_alert.uid; + } +); export default SilenceGrafanaRuleDrawer; diff --git a/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx b/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx index 405f2f4ae2d..259f3038081 100644 --- a/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx +++ b/public/app/features/alerting/unified/rule-list/components/RuleActionsButtons.V2.tsx @@ -9,7 +9,6 @@ import { RedirectToCloneRule } from 'app/features/alerting/unified/components/ru import { INSTANCES_DISPLAY_LIMIT } from 'app/features/alerting/unified/components/rules/RuleDetails'; import SilenceGrafanaRuleDrawer from 'app/features/alerting/unified/components/silences/SilenceGrafanaRuleDrawer'; import { useRulesFilter } from 'app/features/alerting/unified/hooks/useFilteredRules'; -import { AlertmanagerProvider } from 'app/features/alerting/unified/state/AlertmanagerContext'; import { useDispatch } from 'app/types'; import { Rule, RuleGroupIdentifierV2, RuleIdentifier } from 'app/types/unified-alerting'; import { RulerRuleDTO } from 'app/types/unified-alerting-dto'; @@ -93,9 +92,7 @@ export function RuleActionsButtons({ compact, rule, promRule, groupIdentifier }: /> {deleteModal} {isGrafanaAlertingRule(rule) && showSilenceDrawer && ( - - setShowSilenceDrawer(false)} /> - + setShowSilenceDrawer(false)} /> )} {redirectToClone?.identifier && (