Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Shimmer now respects length of children

Jonathan Summers-Muirdf8266d39b9a
diff --git a/studio/components/interfaces/Auth/AutoSchemaForm.tsx b/studio/components/interfaces/Auth/AutoSchemaForm.tsx
index 080e66f5093..0fbd89f92c4 100644
--- a/studio/components/interfaces/Auth/AutoSchemaForm.tsx
+++ b/studio/components/interfaces/Auth/AutoSchemaForm.tsx
@@ -36,11 +36,12 @@ const AutoSchemaForm = observer(() => {
})
const isLoaded = authConfig.isLoaded
+ const formId = 'auth-config-general-form'
return (
<>
<Form
- id="auth-config-general-form"
+ id={formId}
initialValues={INITIAL_VALUES}
onSubmit={async (values: any, { setSubmitting, resetForm }: any) => {
const payload = { ...values }
@@ -92,6 +93,7 @@ const AutoSchemaForm = observer(() => {
isSubmitting={isSubmitting}
hasChanges={hasChanges}
helper={'Learn more about global Auth settings'}
+ form={formId}
/>
</div>
}
diff --git a/studio/components/ui/Forms/FormSection.tsx b/studio/components/ui/Forms/FormSection.tsx
index 9f112b470b7..73de99532d8 100644
--- a/studio/components/ui/Forms/FormSection.tsx
+++ b/studio/components/ui/Forms/FormSection.tsx
@@ -1,3 +1,5 @@
+import { Children } from 'react'
+
const FormSection = ({
children,
header,
@@ -29,6 +31,16 @@ const FormSection = ({
const FormSectionLabel = ({ children }: { children: React.ReactNode | string }) => {
return <label className="text-scale-1200 col-span-12 text-sm lg:col-span-5">{children}</label>
}
+
+const Shimmer = () => (
+ <div className="flex w-full flex-col gap-2">
+ <div className="shimmering-loader h-2 w-1/3 rounded"></div>
+ <div className="flex flex-col justify-between space-y-2">
+ <div className="shimmering-loader h-[34px] w-2/3 rounded" />
+ </div>
+ </div>
+)
+
const FormSectionContent = ({
children,
loading = true,
@@ -48,16 +60,7 @@ const FormSectionContent = ({
${className}
`}
>
- {loading ? (
- <div className="flex w-full flex-col gap-2">
- <div className="shimmering-loader h-2 w-1/3 rounded"></div>
- <div className="flex flex-col justify-between space-y-2">
- <div className="shimmering-loader h-[34px] w-2/3 rounded" />
- </div>
- </div>
- ) : (
- children
- )}
+ {loading ? Children.map(children, (child) => <Shimmer />) : children}
</div>
)
}