fix(dashboard): product create input focus (#8095)

This commit is contained in:
Frane Polić authored and GitHub committed 2024-07-11 18:09:49 +02:00
1 parent 78f49286d0
commit ac416e99a1
1 file changed
+9 -1
@@ -26,6 +26,11 @@ export const ProductCreateVariantsForm = ({
const { price_preferences: pricePreferences } = usePricePreferences({}) const { price_preferences: pricePreferences } = usePricePreferences({})
const currencyCodes = useMemo(
() => store?.supported_currencies?.map((c) => c.currency_code) || [],
[store]
)
const variants = useWatch({ const variants = useWatch({
control: form.control, control: form.control,
name: "variants", name: "variants",
@@ -38,9 +43,12 @@ export const ProductCreateVariantsForm = ({
defaultValue: [], defaultValue: [],
}) })
/**
* NOTE: anything that goes to the datagrid component needs to be memoised otherwise DataGrid will rerender and inputs will loose focus
*/
const columns = useColumns({ const columns = useColumns({
options, options,
currencies: store?.supported_currencies?.map((c) => c.currency_code) || [], currencies: currencyCodes,
regions, regions,
pricePreferences, pricePreferences,
}) })