frontend-plugin-api: allow clearing multi inputs

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-08-12 09:52:35 +02:00
parent 3d7d38d94f
commit cf3de79c24
3 changed files with 8 additions and 5 deletions
@@ -850,7 +850,7 @@ describe('createExtension', () => {
return originalFactory({
inputs: {
single: [testDataRef1('single')],
multi: [[testDataRef1('multi1')], [testDataRef1('multi2')]],
multi: [],
},
});
},
@@ -865,7 +865,7 @@ describe('createExtension', () => {
opt: 'none',
single: 'single',
singleOpt: 'none',
multi: 'multi1,multi2',
multi: '',
});
// Forward inputs directly
@@ -426,7 +426,7 @@ describe('createExtensionBlueprint', () => {
{
inputs: {
single: [testDataRef1('single')],
multi: [[testDataRef1('multi1')], [testDataRef1('multi2')]],
multi: [],
},
},
);
@@ -439,7 +439,7 @@ describe('createExtensionBlueprint', () => {
opt: 'none',
single: 'single',
singleOpt: 'none',
multi: 'multi1,multi2',
multi: '',
}),
]);
@@ -353,7 +353,10 @@ export function resolveInputOverrides(
`override data provided for input '${name}' must be an array`,
);
}
if (originalInput.length !== providedData.length) {
if (
originalInput.length !== providedData.length &&
providedData.length > 0
) {
throw new Error(
`override data provided for input '${name}' must match the length of the original inputs`,
);