frontend-plugin-api: allow clearing multi inputs
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user