fix: ignore yup test validation if stage array is empty

This commit is contained in:
Marc-Roig 2023-07-18 12:26:05 +02:00
parent 490a8c239e
commit 252b616804
No known key found for this signature in database
GPG Key ID: FB4E2C43A0BEE249

View File

@ -64,7 +64,7 @@ const validateWorkflowUpdateSchema = yup.object().shape({
.test('unique', function (stages) { .test('unique', function (stages) {
const errors = []; const errors = [];
stages.forEach((stage, index) => { stages?.forEach((stage, index) => {
const sameNameStages = stages.filter((s) => s.name === stage.name); const sameNameStages = stages.filter((s) => s.name === stage.name);
if (sameNameStages.length > 1) { if (sameNameStages.length > 1) {
errors.push( errors.push(