fix(ticket116): isoler crash plugin hello-plugin + erreur explicite UI
This commit is contained in:
@ -30,6 +30,10 @@ function nonEmptyString(value: unknown): string | undefined {
|
||||
return typeof value === "string" && value.trim().length > 0 ? value : undefined;
|
||||
}
|
||||
|
||||
function objectOrNull(value: unknown): Record<string, unknown> | null {
|
||||
return value !== null && typeof value === "object" ? (value as Record<string, unknown>) : null;
|
||||
}
|
||||
|
||||
function finiteOrder(value: unknown): number {
|
||||
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
||||
}
|
||||
@ -42,8 +46,10 @@ export function listPluginLayoutChoices(registry: PluginRuntimeRegistry): Plugin
|
||||
return registry
|
||||
.layoutContributions()
|
||||
.flatMap(({ pluginId, pluginDisplayName, layout }) => {
|
||||
const type = nonEmptyString(layout.type);
|
||||
const label = nonEmptyString(layout.label);
|
||||
const layoutObject = objectOrNull(layout);
|
||||
if (!layoutObject) return [];
|
||||
const type = nonEmptyString(layoutObject.type);
|
||||
const label = nonEmptyString(layoutObject.label);
|
||||
if (!type || !label) return [];
|
||||
return [
|
||||
{
|
||||
@ -53,8 +59,8 @@ export function listPluginLayoutChoices(registry: PluginRuntimeRegistry): Plugin
|
||||
...layout,
|
||||
type,
|
||||
label,
|
||||
order: finiteOrder(layout.order),
|
||||
icon: nonEmptyString(layout.icon),
|
||||
order: finiteOrder(layoutObject.order),
|
||||
icon: nonEmptyString(layoutObject.icon),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user