@trops/dash-core 0.1.468 → 0.1.470

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
@@ -14667,7 +14667,18 @@ function forEachWidget(workspace, visit) {
14667
14667
  _iterator2.f();
14668
14668
  }
14669
14669
  };
14670
- _walk(workspace.layout);
14670
+
14671
+ // Walk pages BEFORE workspace.layout. WorkspaceModel auto-migrates a
14672
+ // workspace with no persisted `pages` by aliasing pages[0].layout to
14673
+ // workspace.layout. After any per-page edit, pages[0].layout is
14674
+ // replaced with a new array (fresh) but workspace.layout is left
14675
+ // pointing at the original (stale) array. Walking layout first +
14676
+ // dedupe-by-stableId then visited the stale top-level item and
14677
+ // skipped the fresh page version, so the bulk-edit modal kept
14678
+ // reading pre-edit provider bindings. Walking pages first means the
14679
+ // fresh data wins; workspace.layout remains as a fallback for
14680
+ // widgets that only live there (e.g. AI-place writes that bypass
14681
+ // the page handler).
14671
14682
  if (Array.isArray(workspace.pages)) {
14672
14683
  var _iterator3 = _createForOfIteratorHelper$t(workspace.pages),
14673
14684
  _step3;
@@ -14682,6 +14693,7 @@ function forEachWidget(workspace, visit) {
14682
14693
  _iterator3.f();
14683
14694
  }
14684
14695
  }
14696
+ _walk(workspace.layout);
14685
14697
  _walk(workspace.sidebarLayout);
14686
14698
  }
14687
14699
 
@@ -59951,7 +59963,41 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
59951
59963
  pageRefsMap.current[pageId] = {
59952
59964
  current: updatedWorkspace
59953
59965
  };
59954
- }, []);
59966
+
59967
+ // Also update the React state so workspaceSelected (which the
59968
+ // dashboard config bulk-edit modal reads) stays in sync. Before
59969
+ // this, page-level edits only flowed into pageRefsMap and the
59970
+ // bulk modal kept rendering pre-edit data — even when the
59971
+ // PanelEditItemProviders fix correctly wrote both layers and
59972
+ // the LayoutBuilder fix correctly propagated up. The data
59973
+ // arrived; it just never reached the React state the bulk
59974
+ // modal subscribes to.
59975
+ //
59976
+ // Mirror the new page's `layout` into the active tab's matching
59977
+ // page, AND bring forward the workspace-level
59978
+ // `selectedProviders` map so layer-2 writes from per-widget
59979
+ // edits land in state the bulk modal can see.
59980
+ if (!activeTabId || !updatedWorkspace) return;
59981
+ setOpenTabs(function (prev) {
59982
+ return prev.map(function (tab) {
59983
+ var _updatedWorkspace$sel;
59984
+ if (tab.id !== activeTabId) return tab;
59985
+ var tabWs = tab.workspace;
59986
+ if (!tabWs) return tab;
59987
+ var nextPages = Array.isArray(tabWs.pages) ? tabWs.pages.map(function (p) {
59988
+ return p && p.id === pageId ? _objectSpread$6(_objectSpread$6({}, p), {}, {
59989
+ layout: updatedWorkspace.layout
59990
+ }) : p;
59991
+ }) : tabWs.pages;
59992
+ return _objectSpread$6(_objectSpread$6({}, tab), {}, {
59993
+ workspace: _objectSpread$6(_objectSpread$6({}, tabWs), {}, {
59994
+ pages: nextPages,
59995
+ selectedProviders: (_updatedWorkspace$sel = updatedWorkspace.selectedProviders) !== null && _updatedWorkspace$sel !== void 0 ? _updatedWorkspace$sel : tabWs.selectedProviders
59996
+ })
59997
+ });
59998
+ });
59999
+ });
60000
+ }, [activeTabId]);
59955
60001
 
59956
60002
  // Keep stable callback refs current
59957
60003
  stableProviderSelectRef.current = handleProviderSelect;