@trops/dash-core 0.1.335 → 0.1.337

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -27358,7 +27358,21 @@ var WorkspaceModel = function WorkspaceModel(workspaceItem) {
27358
27358
  workspace.type = "type" in obj ? sanitizeType(obj["type"]) : "workspace";
27359
27359
  workspace.label = "label" in obj ? obj["label"] : "New Dashboard";
27360
27360
  workspace.version = "version" in obj ? obj["version"] : 1;
27361
- workspace.layout = "layout" in obj && Array.isArray(obj["layout"]) && obj["layout"].length > 0 ? obj["layout"] : defaultGridLayout();
27361
+ // Use the provided layout if it exists and is non-empty; otherwise
27362
+ // create a default 1x1 grid so the workspace always has a renderable
27363
+ // grid container.
27364
+ var rawLayout = "layout" in obj && Array.isArray(obj["layout"]) && obj["layout"].length > 0 ? obj["layout"] : defaultGridLayout();
27365
+
27366
+ // Normalize each layout item through LayoutModel so renderers get a
27367
+ // fully-shaped object (contexts, listeners, eventHandlers, etc.).
27368
+ // Without this, layouts coming from createLayoutFromTemplate (the
27369
+ // wizard) are missing fields and the grid container fails to render.
27370
+ // Skip items already produced by LayoutModel (idempotent: LayoutModel
27371
+ // is safe to call on its own output).
27372
+ var wsId = "id" in obj ? obj["id"] : workspace.id;
27373
+ workspace.layout = rawLayout.map(function (item) {
27374
+ return LayoutModel(item, rawLayout, wsId);
27375
+ });
27362
27376
  workspace.pages = "pages" in obj ? obj["pages"] : [];
27363
27377
  workspace.activePageId = "activePageId" in obj ? obj["activePageId"] : null;
27364
27378
 
@@ -51679,6 +51693,16 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
51679
51693
  // whenever a navigation happens through navigateToPage().
51680
51694
  var pageHistoryRef = useRef([]);
51681
51695
 
51696
+ // Reset local activePageId when the active tab changes so the next
51697
+ // render falls back to the new workspace's saved activePageId
51698
+ // (or its first page). Without this, a stale activePageId from a
51699
+ // previously-active dashboard would prevent the new dashboard's
51700
+ // pages from rendering (no page matches → all hidden).
51701
+ useEffect(function () {
51702
+ setActivePageId(null);
51703
+ pageHistoryRef.current = [];
51704
+ }, [activeTabId]);
51705
+
51682
51706
  // Wrapper that records history before switching pages.
51683
51707
  // Pass recordHistory=false to switch without recording (e.g. for goBack).
51684
51708
  var navigateToPage = useCallback(function (pageId) {