eschutho commented on code in PR #30888:
URL: https://github.com/apache/superset/pull/30888#discussion_r1931408844


##########
superset/models/dashboard.py:
##########
@@ -338,12 +338,16 @@ def build_tab_tree(
         root = get_node("ROOT_ID")
         tab_tree: list[dict[str, Any]] = []
         all_tabs: dict[str, str] = {}
+        tabs_order: list[str] = []
         queue: deque[tuple[dict[str, Any], list[dict[str, Any]]]] = deque()
         queue.append((root, tab_tree))
         while queue:
             node, children = queue.popleft()
             build_tab_tree(node, children)
-
+            if (childs := node.get("children")) and node["type"] == "TABS":
+                tabs_order.extend(childs)
+        if tabs_order:
+            all_tabs = {str(t): all_tabs[str(t)] for t in tabs_order}

Review Comment:
   @US579 Since the api (in addition to the dictionary for all_tabs) returns a 
nested array structure of the tabs which would maintain their order, can you 
iterate through the tab_tree instead of relying on the all_tabs dict? 
   <img width="852" alt="Screenshot 2025-01-27 at 5 34 32 PM" 
src="https://github.com/user-attachments/assets/8e810479-e828-48f2-8ae1-a5d9ad8145af";
 />
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to