-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Actions] Fixes issue which causes PagerDuty Params to rerender continuously. #85050
Conversation
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
@@ -115,7 +115,7 @@ export const ActionTypeForm = ({ | |||
} | |||
} | |||
// eslint-disable-next-line react-hooks/exhaustive-deps | |||
}, [actionItem.group, defaultParams]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the important part of the fix.
It ensures that we only reapply the defaultParams
when the group has been changed.
Ideally we'd only do so when the group has changed and the params aren't the same as what's already there, but this doesn't work because it causes it to overwrite non-default values selected by the user.
In the future we should apply the default to the actual action object in memory a level above, instead of the ActionForm doing it. But that's a bigger fix that would cause Main to remain broken for longer.
const recoveryActionGroup = selectedAlertType?.recoveryActionGroup?.id; | ||
const getDefaultActionParams = useCallback( | ||
(actionTypeId: string, actionGroupId: string): Record<string, AlertActionParam> | undefined => | ||
getDefaultsForActionParams( | ||
actionTypeId, | ||
actionGroupId, | ||
actionGroupId === recoveryActionGroup | ||
), | ||
[recoveryActionGroup] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures we can keep the concept of a recovery group out of the actions code.
Not ideal, but good enough for now IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Verified that adding a PagerDuty to an alert does not freeze the browser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM! Ran it locally and can confirm the params form renders normally.
…nuously. (elastic#85050) * prevent aciton form from rerendering constantly * fixed typing
…nuously. (#85050) (#85063) * prevent aciton form from rerendering constantly * fixed typing Co-authored-by: Gidi Meir Morris <[email protected]>
Summary
Fixes issue which causes PagerDuty Params to rerender continuously.
Checklist
Delete any items that are not applicable to this PR.
Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n supportDocumentation was added for features that require explanation or tutorialsAny UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)This renders correctly on smaller devices using a responsive layout. (You can test this in your browser)This was checked for cross-browser compatibilityFor maintainers