Skip to content

Commit

Permalink
pods: Keep ports aligned with their errors in PodCreateModal
Browse files Browse the repository at this point in the history
The "publish" and "validationFailed.publish" arrays must always be
aligned. The "validateForm" function was erronously filtering out
undefined entries in validationFailed.publish.

Those undefined entries correspond to empty slots in the "publish"
array and are left behind by the DynamicListForm component when
removing rows in the UI. It does that for its own convenience and we
must respect that.

The observable result of filtering out these entries was that
validation errors would shift to unrelated publish entries. If that
unrelated entry was a empty slot, it would thereafter never be updated
and keep its validation error forever, which would keep the "Create"
button disabled forever.
  • Loading branch information
mvollmer authored and martinpitt committed Oct 18, 2024
1 parent ae3b7e1 commit 6f482bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PodCreateModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const PodCreateModal = ({ user, systemServiceAvailable, userServiceAvaila
};
});
if (publishValidation.some(entry => entry && Object.keys(entry).length > 0))
newValidationFailed.publish = publishValidation.filter(entry => entry !== undefined);
newValidationFailed.publish = publishValidation;

const podNameValidation = validatePodName(podName);

Expand Down

0 comments on commit 6f482bc

Please sign in to comment.