@betterstart/cli 0.1.54 → 0.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2667,7 +2667,7 @@ export function ${p7.pascal}Form() {
2667
2667
  import { zodResolver } from '@hookform/resolvers/zod'
2668
2668
  import { ChevronLeft, ChevronRight${p7.hasListFields ? ", Trash2" : ""} } from 'lucide-react'
2669
2669
  import { parseAsInteger, useQueryState } from 'nuqs'
2670
- import { useState } from 'react'
2670
+ import { useEffect, useRef, useState } from 'react'
2671
2671
  ${p7.rhfImport}
2672
2672
  import { z } from 'zod/v3'${queryClientImport}
2673
2673
  import { create${p7.pascal}Submission } from '@cms/actions/${p7.kebab}-form'
@@ -2714,6 +2714,14 @@ ${formComponentDecl}() {
2714
2714
  ${p7.defaults}
2715
2715
  },
2716
2716
  })
2717
+
2718
+ const prevStep = useRef(currentStep)
2719
+ useEffect(() => {
2720
+ if (currentStep !== prevStep.current) {
2721
+ form.clearErrors(STEPS[currentStep].fields as (keyof FormValues)[])
2722
+ prevStep.current = currentStep
2723
+ }
2724
+ }, [currentStep, form])
2717
2725
  ${p7.fieldArraySetup}${p7.watchSetup}
2718
2726
  async function handleNext() {
2719
2727
  const isValid = await form.trigger(