@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.esm.js
CHANGED
|
@@ -28734,8 +28734,16 @@ var WorkspaceModel = function WorkspaceModel(workspaceItem) {
|
|
|
28734
28734
|
// Skip items already produced by LayoutModel (idempotent: LayoutModel
|
|
28735
28735
|
// is safe to call on its own output).
|
|
28736
28736
|
var wsId = "id" in obj ? obj["id"] : workspace.id;
|
|
28737
|
+
// LayoutModel returns null when an item can't be normalized (e.g.
|
|
28738
|
+
// throw inside its catch). A null in the layout array crashes
|
|
28739
|
+
// downstream forEach/map consumers with `Cannot read properties of
|
|
28740
|
+
// null (reading 'type')`. Filter nulls so the renderer never sees
|
|
28741
|
+
// them — the original raw item is already lost at that point, so
|
|
28742
|
+
// dropping it is the only safe action.
|
|
28737
28743
|
workspace.layout = rawLayout.map(function (item) {
|
|
28738
28744
|
return LayoutModel(item, rawLayout, wsId);
|
|
28745
|
+
}).filter(function (item) {
|
|
28746
|
+
return item != null;
|
|
28739
28747
|
});
|
|
28740
28748
|
workspace.pages = "pages" in obj ? obj["pages"] : [];
|
|
28741
28749
|
workspace.activePageId = "activePageId" in obj ? obj["activePageId"] : null;
|
|
@@ -57406,26 +57414,36 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
57406
57414
|
try {
|
|
57407
57415
|
var _message$workspaces;
|
|
57408
57416
|
var workspaces = deepCopy(message["workspaces"]);
|
|
57417
|
+
// LayoutModel returns null when normalization throws (e.g. a
|
|
57418
|
+
// widget config that references a component the registry can't
|
|
57419
|
+
// resolve yet — common right after a fresh dashboard install
|
|
57420
|
+
// where some widgets are still downloading). Filter nulls so
|
|
57421
|
+
// every renderer that walks the layout sees only well-formed
|
|
57422
|
+
// items and never crashes on `Cannot read properties of null
|
|
57423
|
+
// (reading 'type')` or similar.
|
|
57409
57424
|
var workspacesTemp = workspaces.map(function (ws) {
|
|
57410
|
-
|
|
57425
|
+
ws["layout"] = (ws["layout"] || []).map(function (layoutOG) {
|
|
57411
57426
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
57427
|
+
}).filter(function (item) {
|
|
57428
|
+
return item != null;
|
|
57412
57429
|
});
|
|
57413
|
-
ws["layout"] = tempLayout;
|
|
57414
|
-
// Normalize page layouts too
|
|
57415
57430
|
if (ws.pages && Array.isArray(ws.pages)) {
|
|
57416
57431
|
ws.pages = ws.pages.map(function (page) {
|
|
57417
57432
|
if (page.layout && Array.isArray(page.layout)) {
|
|
57418
57433
|
page.layout = page.layout.map(function (layoutOG) {
|
|
57419
57434
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
57435
|
+
}).filter(function (item) {
|
|
57436
|
+
return item != null;
|
|
57420
57437
|
});
|
|
57421
57438
|
}
|
|
57422
57439
|
return page;
|
|
57423
57440
|
});
|
|
57424
57441
|
}
|
|
57425
|
-
// Normalize sidebar layout
|
|
57426
57442
|
if (ws.sidebarLayout && Array.isArray(ws.sidebarLayout)) {
|
|
57427
57443
|
ws.sidebarLayout = ws.sidebarLayout.map(function (layoutOG) {
|
|
57428
57444
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
57445
|
+
}).filter(function (item) {
|
|
57446
|
+
return item != null;
|
|
57429
57447
|
});
|
|
57430
57448
|
}
|
|
57431
57449
|
return WorkspaceModel(ws);
|
|
@@ -58209,13 +58227,16 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
58209
58227
|
}
|
|
58210
58228
|
function handleSaveWorkspaceComplete(e, message) {
|
|
58211
58229
|
|
|
58212
|
-
// Reconstruct workspaces through LayoutModel (same as load path)
|
|
58230
|
+
// Reconstruct workspaces through LayoutModel (same as load path).
|
|
58231
|
+
// Filter nulls so a partially-failed normalize doesn't poison the
|
|
58232
|
+
// layout array — see handleLoadWorkspacesComplete for the rationale.
|
|
58213
58233
|
var workspaces = deepCopy(message["workspaces"]);
|
|
58214
58234
|
var workspacesTemp = workspaces.map(function (ws) {
|
|
58215
|
-
|
|
58235
|
+
ws["layout"] = (ws["layout"] || []).map(function (layoutOG) {
|
|
58216
58236
|
return LayoutModel(layoutOG, workspaces, ws["id"]);
|
|
58237
|
+
}).filter(function (item) {
|
|
58238
|
+
return item != null;
|
|
58217
58239
|
});
|
|
58218
|
-
ws["layout"] = tempLayout;
|
|
58219
58240
|
return WorkspaceModel(ws);
|
|
58220
58241
|
});
|
|
58221
58242
|
pub.pub("dashboard.workspaceChange", {
|