From add8a596f2144c74350a7e29001b4a0133919bb6 Mon Sep 17 00:00:00 2001 From: Vallhalen Date: Tue, 7 Apr 2026 19:19:05 +0200 Subject: [PATCH 1/2] fix: default adminPages and dashboardWidgets to empty arrays in manifest When a plugin descriptor has `adminPages` or `adminWidgets` set to `undefined` (e.g. not declared), the manifest passes `undefined` to the admin UI, which then crashes with "Cannot read properties of undefined (reading 'map')" when iterating over them. This applies the `?? []` fallback in all three code paths that populate the manifest: node_modules plugins, sandboxed (standard format) plugins, and marketplace plugins. Fixes #355 --- packages/core/src/emdash-runtime.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/emdash-runtime.ts b/packages/core/src/emdash-runtime.ts index 810b0bbae..abfb3e1b8 100644 --- a/packages/core/src/emdash-runtime.ts +++ b/packages/core/src/emdash-runtime.ts @@ -1238,8 +1238,8 @@ export class EmDashRuntime { version: plugin.version, enabled, adminMode, - adminPages: plugin.admin?.pages, - dashboardWidgets: plugin.admin?.widgets, + adminPages: plugin.admin?.pages ?? [], + dashboardWidgets: plugin.admin?.widgets ?? [], portableTextBlocks: plugin.admin?.portableTextBlocks, fieldWidgets: plugin.admin?.fieldWidgets, }; @@ -1261,8 +1261,8 @@ export class EmDashRuntime { enabled, sandboxed: true, adminMode: hasAdminPages || hasWidgets ? "blocks" : "none", - adminPages: entry.adminPages, - dashboardWidgets: entry.adminWidgets, + adminPages: entry.adminPages ?? [], + dashboardWidgets: entry.adminWidgets ?? [], }; } @@ -1284,8 +1284,8 @@ export class EmDashRuntime { enabled, sandboxed: true, adminMode: hasAdminPages || hasWidgets ? "blocks" : "none", - adminPages: pages, - dashboardWidgets: widgets, + adminPages: pages ?? [], + dashboardWidgets: widgets ?? [], }; } From e765677bd17ba9ad67c68645538c8019e706d390 Mon Sep 17 00:00:00 2001 From: Vallhalen Date: Wed, 8 Apr 2026 23:02:39 +0200 Subject: [PATCH 2/2] Add changeset for plugin admin pages fix --- .changeset/fix-plugin-admin-pages.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-plugin-admin-pages.md diff --git a/.changeset/fix-plugin-admin-pages.md b/.changeset/fix-plugin-admin-pages.md new file mode 100644 index 000000000..8d90e24a9 --- /dev/null +++ b/.changeset/fix-plugin-admin-pages.md @@ -0,0 +1,5 @@ +--- +"emdash": patch +--- + +Fix: default adminPages and dashboardWidgets to empty arrays in manifest to prevent admin UI crash when plugins omit these properties.