From 4b6ca3a332a4d031086aeef6a25b1edbb69fcda2 Mon Sep 17 00:00:00 2001 From: Teppo Kurki Date: Thu, 4 Jan 2024 08:41:26 +0200 Subject: [PATCH] fix: guard against missing plugin schema (#1662) Loading the configuration form for a plugin with no schema would crash the configuration ui and the browser would persist the configuration ui state so that subsequent attempts to navigate to plugin configuration would try to open the problematic plugin's configuration, again resulting in a ui crash. Change the server to always provide an empty schema in case the plugin is not defining one and log an error message about it when the plugin configuration page is loaded. --- src/interfaces/plugins.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/interfaces/plugins.ts b/src/interfaces/plugins.ts index ec245f58b..5465f7db9 100644 --- a/src/interfaces/plugins.ts +++ b/src/interfaces/plugins.ts @@ -184,6 +184,11 @@ module.exports = (theApp: any) => { .then(([schema, uiSchema]) => { const status = providerStatus.find((p: any) => p.id === plugin.name) const statusMessage = status ? status.message : '' + if (schema === undefined) { + console.error( + `Error: plugin ${plugin.id} is missing configuration schema` + ) + } resolve({ id: plugin.id, name: plugin.name, @@ -191,7 +196,7 @@ module.exports = (theApp: any) => { keywords: plugin.keywords, version: plugin.version, description: plugin.description, - schema, + schema: schema || {}, statusMessage, uiSchema, state: plugin.state,