You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/11 16:36:06 UTC

(superset) branch master updated: fix(export): derive chart_hashes and zip from a single chart list (#42946)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5099b6ffa95 fix(export): derive chart_hashes and zip from a single chart list (#42946)
5099b6ffa95 is described below

commit 5099b6ffa9531503909b52b222bb6d6eae3f3a32
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Tue Aug 11 09:35:59 2026 -0700

    fix(export): derive chart_hashes and zip from a single chart list (#42946)
    
    Co-authored-by: Claude Sonnet 5 <no...@anthropic.com>
---
 superset/commands/dashboard/export.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/superset/commands/dashboard/export.py b/superset/commands/dashboard/export.py
index 30d7b60eeb7..218bdc80f59 100644
--- a/superset/commands/dashboard/export.py
+++ b/superset/commands/dashboard/export.py
@@ -19,7 +19,7 @@
 import logging
 import uuid as uuid_module
 from typing import Any, Optional, Callable
-from collections.abc import Iterator
+from collections.abc import Collection, Iterator
 
 import yaml
 
@@ -62,8 +62,13 @@ def get_default_position(title: str) -> dict[str, Any]:
     }
 
 
-def append_charts(position: dict[str, Any], charts: set[Slice]) -> dict[str, Any]:
-    chart_hashes = [f"CHART-{str(chart.uuid)}" for chart in charts]
+def append_charts(
+    position: dict[str, Any], charts: Collection[Slice]
+) -> dict[str, Any]:
+    # Materialize the collection into a list once so chart_hashes and the zip
+    # below iterate the exact same ordering and can never desynchronize.
+    chart_list = list(charts)
+    chart_hashes = [f"CHART-{str(chart.uuid)}" for chart in chart_list]
 
     # if we have ROOT_ID/GRID_ID, append orphan charts to a new row inside the grid
     row_hash = None
@@ -78,7 +83,7 @@ def append_charts(position: dict[str, Any], charts: set[Slice]) -> dict[str, Any
             "parents": ["ROOT_ID", "GRID_ID"],
         }
 
-    for chart_hash, chart in zip(chart_hashes, charts, strict=False):
+    for chart_hash, chart in zip(chart_hashes, chart_list, strict=False):
         position[chart_hash] = {
             "children": [],
             "id": chart_hash,