Skip to content

Commit

Permalink
fix(alerts): force re-render for stale RuleForm (#82842)
Browse files Browse the repository at this point in the history
Closes #82335.

This PR "fixes" a state bug that occurs when an Alert is edited, saved,
and then edited again. It's an admittedly gross hack, but we're about to
completely refactor the `RuleForm` component as part of the Alerts
Create Issues (ACI) project!
  • Loading branch information
natemoo-re authored Jan 3, 2025
1 parent 0ab6cb8 commit ec0f3f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions static/app/views/alerts/rules/metric/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function MetricRulesEdit({
{
staleTime: 0,
retry: false,
refetchOnMount: true,
}
);

Expand Down Expand Up @@ -97,6 +98,9 @@ export function MetricRulesEdit({
return (
<RuleForm
{...props}
// HACK: gnarly workaround to force the component to re-render when rule updates
// Remove this once the RuleForm component is refactored to use `react-query`
key={JSON.stringify(rule)}
params={params}
project={project}
userTeamIds={userTeamIds}
Expand Down

0 comments on commit ec0f3f1

Please sign in to comment.