Skip to content

Commit

Permalink
remove return before useState
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieljaegerde committed Apr 25, 2024
1 parent ccb281c commit ec6fbf7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/[chain]/referendum-rewards/components/form-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ export default function FormActions({
const otherSteps = [0, 1, 2].filter((index) => index > step).map(String);

const [signingIndex, setSigningIndex] = useState<number>(0);
if (!rewardSendoutData?.kusamaAssetHubTxs) {
return;
}
const amountOfTxs = Math.ceil(rewardSendoutData?.kusamaAssetHubTxs?.length / rewardsConfig.NFT_BATCH_SIZE_MAX);


const [txResult, setTxResult] = useState<SendAndFinalizeResult[]>();

const formMethods = useFormContext();
Expand All @@ -98,6 +94,12 @@ export default function FormActions({

const watchFormFields = watch();

if (!rewardSendoutData?.kusamaAssetHubTxs) {
// It's better to handle this condition differently or ensure the layout still renders without functional impact.
return <div>No transactions found</div>;
}
const amountOfTxs = Math.ceil(rewardSendoutData?.kusamaAssetHubTxs?.length / rewardsConfig.NFT_BATCH_SIZE_MAX);

function onReset() {
setStep(0);
reset();
Expand Down

0 comments on commit ec6fbf7

Please sign in to comment.