@trops/dash-core 0.1.429 → 0.1.431
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/electron/index.js +137 -12
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +28 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +28 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28752,8 +28752,16 @@ var WorkspaceModel = function WorkspaceModel(workspaceItem) {
|
|
|
28752
28752
|
// Skip items already produced by LayoutModel (idempotent: LayoutModel
|
|
28753
28753
|
// is safe to call on its own output).
|
|
28754
28754
|
var wsId = "id" in obj ? obj["id"] : workspace.id;
|
|
28755
|
+
// LayoutModel returns null when an item can't be normalized (e.g.
|
|
28756
|
+
// throw inside its catch). A null in the layout array crashes
|
|
28757
|
+
// downstream forEach/map consumers with `Cannot read properties of
|
|
28758
|
+
// null (reading 'type')`. Filter nulls so the renderer never sees
|
|
28759
|
+
// them — the original raw item is already lost at that point, so
|
|
28760
|
+
// dropping it is the only safe action.
|
|
28755
28761
|
workspace.layout = rawLayout.map(function (item) {
|
|
28756
28762
|
return LayoutModel(item, rawLayout, wsId);
|
|
28763
|
+
}).filter(function (item) {
|
|
28764
|
+
return item != null;
|
|
28757
28765
|
});
|
|
28758
28766
|
workspace.pages = "pages" in obj ? obj["pages"] : [];
|
|
28759
28767
|
workspace.activePageId = "activePageId" in obj ? obj["activePageId"] : null;
|
|
@@ -57424,26 +57432,36 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
57424
57432
|
try {
|
|
57425
57433
|
var _message$workspaces;
|
|
57426
57434
|
var workspaces = DashReact.deepCopy(message["workspaces"]);
|
|
57435
|
+
// LayoutModel returns null when normalization throws (e.g. a
|
|
57436
|
+
// widget config that references a component the registry can't
|
|
57437
|
+
// resolve yet — common right after a fresh dashboard install
|
|
57438
|
+
// where some widgets are still downloading). Filter nulls so
|
|
57439
|
+
// every renderer that walks the layout sees only well-formed
|
|
57440
|
+
// items and never crashes on `Cannot read properties of null
|
|
57441
|
+
// (reading 'type')` or similar.
|
|
57427
57442
|
var workspacesTemp = workspaces.map(function (ws) {
|
|
57428
|
-
|
|
57443
|
+
ws["layout"] = (ws["layout"] || []).map(function (layoutOG) {
|
|
57429
57444
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
57445
|
+
}).filter(function (item) {
|
|
57446
|
+
return item != null;
|
|
57430
57447
|
});
|
|
57431
|
-
ws["layout"] = tempLayout;
|
|
57432
|
-
// Normalize page layouts too
|
|
57433
57448
|
if (ws.pages && Array.isArray(ws.pages)) {
|
|
57434
57449
|
ws.pages = ws.pages.map(function (page) {
|
|
57435
57450
|
if (page.layout && Array.isArray(page.layout)) {
|
|
57436
57451
|
page.layout = page.layout.map(function (layoutOG) {
|
|
57437
57452
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
57453
|
+
}).filter(function (item) {
|
|
57454
|
+
return item != null;
|
|
57438
57455
|
});
|
|
57439
57456
|
}
|
|
57440
57457
|
return page;
|
|
57441
57458
|
});
|
|
57442
57459
|
}
|
|
57443
|
-
// Normalize sidebar layout
|
|
57444
57460
|
if (ws.sidebarLayout && Array.isArray(ws.sidebarLayout)) {
|
|
57445
57461
|
ws.sidebarLayout = ws.sidebarLayout.map(function (layoutOG) {
|
|
57446
57462
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
57463
|
+
}).filter(function (item) {
|
|
57464
|
+
return item != null;
|
|
57447
57465
|
});
|
|
57448
57466
|
}
|
|
57449
57467
|
return WorkspaceModel(ws);
|
|
@@ -58227,13 +58245,16 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
58227
58245
|
}
|
|
58228
58246
|
function handleSaveWorkspaceComplete(e, message) {
|
|
58229
58247
|
|
|
58230
|
-
// Reconstruct workspaces through LayoutModel (same as load path)
|
|
58248
|
+
// Reconstruct workspaces through LayoutModel (same as load path).
|
|
58249
|
+
// Filter nulls so a partially-failed normalize doesn't poison the
|
|
58250
|
+
// layout array — see handleLoadWorkspacesComplete for the rationale.
|
|
58231
58251
|
var workspaces = DashReact.deepCopy(message["workspaces"]);
|
|
58232
58252
|
var workspacesTemp = workspaces.map(function (ws) {
|
|
58233
|
-
|
|
58253
|
+
ws["layout"] = (ws["layout"] || []).map(function (layoutOG) {
|
|
58234
58254
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
58255
|
+
}).filter(function (item) {
|
|
58256
|
+
return item != null;
|
|
58235
58257
|
});
|
|
58236
|
-
ws["layout"] = tempLayout;
|
|
58237
58258
|
return WorkspaceModel(ws);
|
|
58238
58259
|
});
|
|
58239
58260
|
pub.pub("dashboard.workspaceChange", {
|