Skip to content

Commit baffc5d

Browse files
author
Ruben van Leeuwen
committed
1891: Reintroduces loadinComponent
1 parent e44cf7b commit baffc5d

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

frontend/apps/example/src/app/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export default function Home() {
104104
componentMatcherExtender: componentMatcher,
105105
customTranslations: customTranslations,
106106
locale: locale,
107+
loadingComponent: <div>Custom loading component</div>,
107108
}}
108109
/>
109110
</div>

frontend/packages/pydantic-forms/src/components/render/RenderForm.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const RenderForm = (contextProps: PydanticFormContextProps) => {
3535

3636
const t = useTranslations('renderForm');
3737

38-
const LoadingComponent = <div>{t('loading')}</div>;
38+
const LoadingComponent = config.loadingComponent ?? (
39+
<div>{t('loading')}</div>
40+
);
3941

4042
if (isLoading && !isSending) {
4143
return LoadingComponent;

frontend/packages/pydantic-forms/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ export interface PydanticFormsContextConfig {
261261
// translations
262262
customTranslations?: TranslationsJSON;
263263

264+
loadingComponent?: React.ReactNode;
265+
264266
// locale
265267
locale?: Locale;
266268
}

0 commit comments

Comments
 (0)