This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch sc_74253
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/sc_74253 by this push:
     new aa43362414 Fix tests and lint
aa43362414 is described below

commit aa43362414d73fcef12aa5a0fba48ea45ddd0ca6
Author: Beto Dealmeida <[email protected]>
AuthorDate: Tue Sep 5 22:03:07 2023 -0700

    Fix tests and lint
---
 superset-frontend/src/explore/components/ExploreChartPanel/index.jsx | 2 +-
 superset/charts/schemas.py                                           | 5 +++++
 tests/integration_tests/charts/api_tests.py                          | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx 
b/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx
index 4357d99e86..50f12851c1 100644
--- a/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx
+++ b/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx
@@ -177,7 +177,7 @@ const ExploreChartPanel = ({
    * migration or manually. */
   const updateChart = useCallback(
     async function overwriteChart() {
-      if (slice.force_save) {
+      if (slice?.force_save) {
         await actions.updateSlice(slice, slice.slice_name);
         // TODO (betodealmeida): better refresh logic
         window.location.reload();
diff --git a/superset/charts/schemas.py b/superset/charts/schemas.py
index dabf7fcc0c..bf909345af 100644
--- a/superset/charts/schemas.py
+++ b/superset/charts/schemas.py
@@ -234,6 +234,11 @@ class ChartPostSchema(Schema):
     )
     is_managed_externally = fields.Boolean(allow_none=True, dump_default=False)
     external_url = fields.String(allow_none=True)
+    force_save = fields.Boolean(
+        metadata={
+            "description": "Does the chart need to be re-saved to update 
metadata?"
+        }
+    )
 
 
 class ChartPutSchema(Schema):
diff --git a/tests/integration_tests/charts/api_tests.py 
b/tests/integration_tests/charts/api_tests.py
index ae64eba807..6ee510d654 100644
--- a/tests/integration_tests/charts/api_tests.py
+++ b/tests/integration_tests/charts/api_tests.py
@@ -923,6 +923,7 @@ class TestChartApi(SupersetTestCase, 
ApiOwnersTestCaseMixin, InsertChartMixin):
             "viz_type": None,
             "query_context": None,
             "is_managed_externally": False,
+            "force_save": False,
         }
         data = json.loads(rv.data.decode("utf-8"))
         self.assertIn("changed_on_delta_humanized", data["result"])

Reply via email to