fix rule editor remounting issue (#34228)

This commit is contained in:
Domas
2021-05-18 09:42:52 +03:00
committed by GitHub
parent bd4afe41ba
commit 815603dc19

View File

@@ -22,7 +22,7 @@ const ExistingRuleEditor: FC<ExistingRuleEditorProps> = ({ identifier }) => {
useCleanup((state) => state.unifiedAlerting.ruleForm.existingRule);
const { loading, result, error, dispatched } = useUnifiedAlertingSelector((state) => state.ruleForm.existingRule);
const dispatch = useDispatch();
const { isEditable, loading: loadingEditableStatus } = useIsRuleEditable(result?.rule);
const { isEditable } = useIsRuleEditable(result?.rule);
useEffect(() => {
if (!dispatched) {
@@ -30,7 +30,7 @@ const ExistingRuleEditor: FC<ExistingRuleEditorProps> = ({ identifier }) => {
}
}, [dispatched, dispatch, identifier]);
if (loading || loadingEditableStatus) {
if (loading || isEditable === undefined) {
return (
<Page.Contents>
<LoadingPlaceholder text="Loading rule..." />