Skip to content

Commit

Permalink
fix validation for max delegators rule (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
ost-ptk authored Sep 4, 2024
1 parent f7ad08d commit 6ee10e8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libs/ui/forms/form-validation-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,10 @@ export const useValidatorPublicKeyRule = (
) {
return true;
}
if (delegatorsNumber && !hasDelegationToSelectedValidator) {
if (
(delegatorsNumber === 0 || delegatorsNumber) &&
!hasDelegationToSelectedValidator
) {
return delegatorsNumber < MAX_DELEGATORS;
}

Expand Down Expand Up @@ -480,7 +483,10 @@ export const useNewValidatorPublicKeyRule = (
.test({
name: 'maxDelegators',
test: () => {
if (delegatorsNumber && !hasDelegationToSelectedNewValidator) {
if (
(delegatorsNumber === 0 || delegatorsNumber) &&
!hasDelegationToSelectedNewValidator
) {
return delegatorsNumber < MAX_DELEGATORS;
}

Expand Down

0 comments on commit 6ee10e8

Please sign in to comment.