-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS Heap out of memory in Next.js project #104
Comments
Hello, Are you setting the map on each occurence of zod or just once? |
Hi! the |
There you go: import {
useForm as useFormRHF,
FieldValues,
UseFormProps,
useFieldArray,
FormProvider,
useFormContext,
} from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'
import z, { ZodType } from 'zod'
import { makeZodI18nMap } from 'zod-i18n-map'
import { useTranslation } from '@utils/translation'
interface UseFormCustom {
validationSchema: ZodType
}
export const useForm = <T extends FieldValues, TContext = unknown>({
validationSchema,
...props
}: UseFormProps<T, TContext> & UseFormCustom) => {
const { t } = useTranslation('zod')
z.setErrorMap(makeZodI18nMap({ t }))
return useFormRHF<T, TContext>({
...props,
resolver: zodResolver(validationSchema),
})
}
export { useFieldArray, FormProvider, useFormContext } |
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
I have a pretty simple form component.
When importing
makeZodI18nMap
I'm getting the heap out of memory error and I'm not able to lint or build my code.I'm using it like this:
When commenting the following lines out, I'm able to lint and build my code again.
am I doing something wrong here, or could this possibly be a bug in zod-i18n ?
The text was updated successfully, but these errors were encountered: