File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
frontend/packages/pydantic-forms/src Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -26,18 +26,19 @@ const RenderForm = (contextProps: PydanticFormContextProps) => {
2626 title,
2727 headerComponent,
2828 skipSuccessNotice,
29+ loadingComponent,
2930 } = contextProps ;
3031
31- if ( isLoading && ! isSending ) {
32- return < div > Formulier aan het ophalen... A </ div > ;
33- }
32+ const LoadingComponent = loadingComponent ?? (
33+ < div > Formulier aan het ophalen...</ div >
34+ ) ;
3435
35- if ( ! pydanticFormSchema ) {
36- return < div > Formulier aan het ophalen... B </ div > ;
36+ if ( isLoading && ! isSending ) {
37+ return LoadingComponent ;
3738 }
3839
39- if ( isSending ) {
40- return < div > Formulier aan het verzenden... </ div > ;
40+ if ( ! pydanticFormSchema || isSending ) {
41+ return LoadingComponent ;
4142 }
4243
4344 if ( isFullFilled ) {
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ function PydanticFormContextProvider({
6464 sendLabel,
6565 headerComponent,
6666 footerComponent,
67+ loadingComponent,
6768 successNotice,
6869 onSuccess,
6970 onCancel,
@@ -320,6 +321,7 @@ function PydanticFormContextProvider({
320321 pydanticFormSchema,
321322 headerComponent,
322323 footerComponent,
324+ loadingComponent,
323325 onCancel,
324326 title,
325327 sendLabel,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export interface PydanticFormInitialContextProps {
2828 children : ( props : PydanticFormContextProps ) => React . ReactNode ;
2929 headerComponent ?: React . ReactNode ;
3030 footerComponent ?: React . ReactNode ;
31+ loadingComponent ?: React . ReactNode ;
3132 hasCardWrapper ?: boolean ;
3233
3334 config : PydanticFormsContextConfig ;
@@ -65,6 +66,7 @@ export interface PydanticFormContextProps {
6566 successNotice ?: React . ReactNode ;
6667 headerComponent ?: React . ReactNode ;
6768 footerComponent ?: React . ReactNode ;
69+ loadingComponent ?: React . ReactNode ;
6870 allowUntouchedSubmit ?: boolean ;
6971 skipSuccessNotice ?: boolean ;
7072 footerCtaPrimaryVariant ?: string ;
You can’t perform that action at this time.
0 commit comments