The catagory and brand update in the form takes time unlike other form values #7913
Closed
Thinley-bot
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
`"use client"
import { zodResolver } from '@hookform/resolvers/zod'
import React, { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { Button } from '
/components/ui/button'/components/ui/form'import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '
import { Input } from '
/components/ui/input'/components/ui/select'import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '
import { catalogueFormSchema } from "
/form_schema/catalogue-form"/trpc/react'import { api } from '
import { useParams } from 'next/navigation'
export default function Page() {
const { catalogueid } = useParams<{ catalogueid: string }>();
const form = useForm({
resolver: zodResolver(catalogueFormSchema),
defaultValues: {
part_name: "",
part_number: "",
category_id: "",
brand_id: "",
unit_price: 0,
},
})
}
`
The brand and category loads very slowly each time I view this form. I though of memoizing the brand and category data but the issue is the incresase data volume in future. what could be some great solution so that the Select can render the corresponding brand name and category name smae time like other form values.
Beta Was this translation helpful? Give feedback.
All reactions