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

This commit is contained in:
Frane Polić
2024-07-11 18:09:49 +02:00
committed by GitHub
parent 78f49286d0
commit ac416e99a1
@@ -26,6 +26,11 @@ export const ProductCreateVariantsForm = ({
const { price_preferences: pricePreferences } = usePricePreferences({})
const currencyCodes = useMemo(
() => store?.supported_currencies?.map((c) => c.currency_code) || [],
[store]
)
const variants = useWatch({
control: form.control,
name: "variants",
@@ -38,9 +43,12 @@ export const ProductCreateVariantsForm = ({
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({
options,
currencies: store?.supported_currencies?.map((c) => c.currency_code) || [],
currencies: currencyCodes,
regions,
pricePreferences,
})