From a80efa609c3c71bb1c6041148e4868b53041079c Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Wed, 2 Feb 2022 17:00:05 -0800 Subject: [PATCH] fix: new alert should have force_screenshot be true (#18182) * fix: new alert should have force_screenshot be true * fix comments --- superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 65020aeabf..416f47a4ab 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -516,10 +516,11 @@ const AlertReportModal: FunctionComponent = ({ } }); + const shouldEnableForceScreenshot = contentType === 'chart' && !isReport; const data: any = { ...currentAlert, type: isReport ? 'Report' : 'Alert', - force_screenshot: forceScreenshot ? 'true' : 'false', + force_screenshot: shouldEnableForceScreenshot || forceScreenshot, validator_type: conditionNotNull ? 'not null' : 'operator', validator_config_json: conditionNotNull ? {} @@ -862,6 +863,8 @@ const AlertReportModal: FunctionComponent = ({ const onContentTypeChange = (event: any) => { const { target } = event; + // When switch content type, reset force_screenshot to false + setForceScreenshot(false); // Gives time to close the select before changing the type setTimeout(() => setContentType(target.value), 200); };