Skip to content

Commit

Permalink
fix: sort merged outputs correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Aug 15, 2024
1 parent 0040ac6 commit 5dc5964
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/validation/useValidationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ export function useValidationProvider<

function mergeOutputs(base: TOutput, results: (ValidationResult | GroupValidationResult)[]): TOutput {
const all = cloneDeep(base);
// Make sure we start with groups first since it may override indivdual fields
// Make sure we start with groups first since it may override individual fields
const sorted = [...results].sort((a, b) => {
if (a.type === b.type) {
return 0;
}

return a.type === 'FIELD' ? -1 : 1;
return a.type === 'FIELD' ? 1 : -1;
});

for (const result of sorted) {
Expand Down

0 comments on commit 5dc5964

Please sign in to comment.