diff --git a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx index 506a2c9ebb665..942389e05b82b 100644 --- a/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx +++ b/superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx @@ -513,7 +513,7 @@ const AlertReportModal: FunctionComponent = ({ const data: any = { ...currentAlert, type: isReport ? 'Report' : 'Alert', - force_screenshot: isReport ? 'false' : 'true', + force_screenshot: contentType === 'chart' && !isReport ? 'true' : 'false', validator_type: conditionNotNull ? 'not null' : 'operator', validator_config_json: conditionNotNull ? {} diff --git a/superset/migrations/versions/bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py b/superset/migrations/versions/bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py index c0757a8deec8d..cc698cb8a4987 100644 --- a/superset/migrations/versions/bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py +++ b/superset/migrations/versions/bb38f40aa3ff_add_force_screenshot_to_alerts_reports.py @@ -51,7 +51,10 @@ def upgrade(): session = db.Session(bind=bind) for report in session.query(ReportSchedule).all(): - report.force_screenshot = report.type == "Alert" + # Update existing alerts that send chart screenshots so that the cache is + # bypassed. We don't turn this one for dashboards because (1) it's currently + # not supported but also because (2) it can be very expensive. + report.force_screenshot = report.type == "Alert" and report.chart_id is not None session.commit()