Skip to content

Commit

Permalink
Fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Jan 20, 2025
1 parent ea000a5 commit e25c3d8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const PoolSetupSection = () => {

useEffect(() => {
form.setFieldValue('adminMultisig.signers[0]', substrate.selectedAddress)
}, [substrate])
}, [substrate, form])

return (
<Box>
Expand Down Expand Up @@ -297,7 +297,7 @@ export const PoolSetupSection = () => {
{({ push, remove }) => (
<>
{values.poolFees.map((_, index) => {
if (index === 0) return
if (index === 0) return null
return (
<Box mt={4} mb={3} key={index}>
<StyledGrid mt={3} gap={1}>
Expand Down
39 changes: 21 additions & 18 deletions centrifuge-app/src/pages/IssuerCreatePool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Box, Button, Dialog, Step, Stepper, Text } from '@centrifuge/fabric'
import { createKeyMulti, sortAddresses } from '@polkadot/util-crypto'
import BN from 'bn.js'
import { Form, FormikProvider, useFormik } from 'formik'
import { useEffect, useRef, useState } from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useNavigate } from 'react-router'
import { combineLatest, firstValueFrom, switchMap, tap } from 'rxjs'
import styled, { useTheme } from 'styled-components'
Expand Down Expand Up @@ -128,7 +128,7 @@ const IssuerCreatePoolPage = () => {
// It can take a second for the new data to come in after creating the pool
navigate(`/issuer/${poolId}`)
}
}, [poolId, pools])
}, [poolId, pools, navigate])

const { execute: createProxies, isLoading: createProxiesIsPending } = useCentrifugeTransaction(
`${txMessage[createType]} 1/2`,
Expand Down Expand Up @@ -427,32 +427,35 @@ const IssuerCreatePoolPage = () => {

const { values, errors } = form

const checkStepCompletion = (stepNumber: number) => {
const fields = stepFields[stepNumber]
const checkStepCompletion = useCallback(
(stepNumber: number) => {
const fields = stepFields[stepNumber]

let isValid = fields.every((field) => {
const value = values[field as keyof typeof values]
const error = errors[field as keyof typeof errors]
return value !== null && value !== '' && !error
})
let isValid = fields.every((field) => {
const value = values[field as keyof typeof values]
const error = errors[field as keyof typeof errors]
return value !== null && value !== '' && !error
})

if (values.issuerCategories.length > 1 && errors.issuerCategories) {
isValid = false
}
if (values.issuerCategories.length > 1 && errors.issuerCategories) {
isValid = false
}

if (values.poolRatings.length > 1 && errors.poolRatings) {
isValid = false
}
if (values.poolRatings.length > 1 && errors.poolRatings) {
isValid = false
}

return isValid
}
return isValid
},
[values, errors]
)

useEffect(() => {
setStepCompleted((prev) => ({
...prev,
[step]: checkStepCompletion(step),
}))
}, [values, errors, step, stepFields])
}, [values, errors, step, checkStepCompletion])

useEffect(() => {
if (containerRef.current) {
Expand Down
4 changes: 2 additions & 2 deletions centrifuge-app/src/pages/IssuerCreatePool/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ export const validateValues = (values: CreatePoolValues) => {

if (values.issuerCategories.length > 1) {
values.issuerCategories.forEach((category, i) => {
if (category.type == '') {
if (category.type === '') {
errors = setIn(errors, `issuerCategories.${i}.type`, 'Field is required')
}
if (category.value == '') {
if (category.value === '') {
errors = setIn(errors, `issuerCategories.${i}.value`, 'Field is required')
}
})
Expand Down

0 comments on commit e25c3d8

Please sign in to comment.