The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(studio): datetime formfield components field update (#29823)
Andrew Valleteau83c5cb87ed54
diff --git a/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsxindex 7403a00f71b..431d8a57426 100644--- a/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/AdvancedAuthSettingsForm/AdvancedAuthSettingsForm.tsx@@ -205,7 +205,7 @@ const AdvancedAuthSettingsForm = () => {return (<Form id={formId} initialValues={INITIAL_VALUES} onSubmit={onSubmit} validationSchema={schema}>- {({ handleReset, resetForm, values, initialValues }: any) => {+ {({ handleReset, resetForm, values, initialValues, setFieldValue }: any) => {const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)// Form is reset once remote data is loaded in store@@ -292,6 +292,7 @@ const AdvancedAuthSettingsForm = () => {}}formValues={values}disabled={!canUpdateConfig}+ setFieldValue={setFieldValue}/><InputNumber@@ -322,6 +323,7 @@ const AdvancedAuthSettingsForm = () => {}}formValues={values}disabled={!canUpdateConfig || !isProPlanAndUp}+ setFieldValue={setFieldValue}/>{!hasValidMFAProvider && phoneMFAIsEnabled && (<Alert_Shadcn_ variant="warning">@@ -349,6 +351,7 @@ const AdvancedAuthSettingsForm = () => {}}formValues={values}disabled={!canUpdateConfig || !isProPlanAndUp}+ setFieldValue={setFieldValue}/>{hasUpgradedPhoneMFA && (<Alert_Shadcn_ variant="warning">diff --git a/apps/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsxindex 66765e30e26..e474cea8e5e 100644--- a/apps/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx+++ b/apps/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx@@ -12,6 +12,7 @@ interface FormFieldProps {name: stringproperties: anyformValues: any+ setFieldValue: (field: string, v: any) => anydisabled?: boolean}@@ -19,7 +20,13 @@ function formatDate(date: Date): string {return dayjs(date).format('dddd, MMMM D, YYYY HH:mm:ss Z')}-const FormField = ({ name, properties, formValues, disabled = false }: FormFieldProps) => {+const FormField = ({+ name,+ properties,+ formValues,+ disabled = false,+ setFieldValue,+}: FormFieldProps) => {const [hidden, setHidden] = useState(!!properties.isSecret)const [dateAsText, setDateAsText] = useState(formValues[name] ? formatDate(new Date(formValues[name])) : ''@@ -27,7 +34,7 @@ const FormField = ({ name, properties, formValues, disabled = false }: FormFielduseEffect(() => {if (properties.show && properties.show.key && !formValues[properties.show.key]) {- formValues[name] = ''+ setFieldValue(name, '')setDateAsText('')}}, [properties.show && properties.show.key && !formValues[properties.show.key]])@@ -76,11 +83,11 @@ const FormField = ({ name, properties, formValues, disabled = false }: FormFieldto={formValues[name]}onChange={(date) => {if (date && date.to) {- formValues[name] = date.to+ setFieldValue(name, date.to)setDateAsText(formatDate(new Date(date.to)))} else {setDateAsText('')- formValues[name] = ''+ setFieldValue(name, '')}}}>diff --git a/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsxindex 13a620195e6..69fa28ff76a 100644--- a/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx+++ b/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx@@ -238,7 +238,7 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {validationSchema={provider.validationSchema}onSubmit={onSubmit}>- {({ handleReset, initialValues, values }: any) => {+ {({ handleReset, initialValues, values, setFieldValue }: any) => {const noChanges = JSON.stringify(initialValues) === JSON.stringify(values)return (<Collapsible.Content>@@ -249,6 +249,7 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {<FormFieldkey={x}name={x}+ setFieldValue={setFieldValue}properties={provider.properties[x]}formValues={values}disabled={diff --git a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsxindex e5e7a81c9d7..d4d68c8ced8 100644--- a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx@@ -155,7 +155,7 @@ const BasicAuthSettingsForm = () => {return (<Form id={formId} initialValues={INITIAL_VALUES} onSubmit={onSubmit} validationSchema={schema}>- {({ handleReset, resetForm, values, initialValues }: any) => {+ {({ handleReset, resetForm, values, initialValues, setFieldValue }: any) => {const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)// Form is reset once remote data is loaded in store// eslint-disable-next-line react-hooks/rules-of-hooks@@ -325,6 +325,7 @@ const BasicAuthSettingsForm = () => {],}}formValues={values}+ setFieldValue={setFieldValue}/>{!promptProPlanUpgrade ? (<></>@@ -424,6 +425,7 @@ const BasicAuthSettingsForm = () => {],}}formValues={values}+ setFieldValue={setFieldValue}/><Inputid="SECURITY_CAPTCHA_SECRET"