diff --git a/backend/apps/swarm/entities/dashboards.py b/backend/apps/swarm/entities/dashboards.py index d39198d1..357970cc 100644 --- a/backend/apps/swarm/entities/dashboards.py +++ b/backend/apps/swarm/entities/dashboards.py @@ -93,6 +93,8 @@ class DashboardExportable: nbid = "browser-" + uuid4().hex[:10] c = dict(card) c["browser_id"] = nbid + # Re-stamp the home dashboard, else the card keeps the source's id and the anti-bleed render guard (DashboardCardLayer keepAliveHidden) hides it on the imported dashboard. + c["dashboard_id"] = new_did spawn = c.get("spawned_by") c["spawned_by"] = remap.local(spawn) if spawn else None browser_cards[nbid] = c diff --git a/backend/tests/test_swarm_bundle.py b/backend/tests/test_swarm_bundle.py index 4c1b9b6f..410991f8 100644 --- a/backend/tests/test_swarm_bundle.py +++ b/backend/tests/test_swarm_bundle.py @@ -389,7 +389,7 @@ def test_dashboard_import_remaps_to_fresh_local_ids(monkeypatch): "ABID": {"output_id": "ABID", "parent_session_id": "SBID"}, "ABID2": {"output_id": "ABID2", "parent_session_id": "GONE"}, }, - "browser_cards": {"b1": {"browser_id": "b1", "spawned_by": "SBID"}}, + "browser_cards": {"b1": {"browser_id": "b1", "spawned_by": "SBID", "dashboard_id": "OLD_DASH"}}, "expanded_session_ids": ["SBID", "ORPHAN"], }} remap.assign("ABID2", "newapp2") @@ -399,6 +399,8 @@ def test_dashboard_import_remaps_to_fresh_local_ids(monkeypatch): assert L["view_cards"]["newapp"]["parent_session_id"] == "newsess" assert L["view_cards"]["newapp2"]["parent_session_id"] is None # parent not in bundle assert list(L["browser_cards"].values())[0]["spawned_by"] == "newsess" + # The card's home dashboard must be re-stamped to the new id, else the anti-bleed render guard hides it on the import. + assert list(L["browser_cards"].values())[0]["dashboard_id"] == did assert L["expanded_session_ids"] == ["newsess"] # the dangling ref is dropped