Fix address form not loading
This commit is contained in:
parent
8b22b1c1f8
commit
ee1a4afd25
3 changed files with 17 additions and 10 deletions
5
.changeset/twelve-eyes-wink.md
Normal file
5
.changeset/twelve-eyes-wink.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"saleor-app-invoices": patch
|
||||
---
|
||||
|
||||
Fixed address form not loading if not data was set before
|
|
@ -4,14 +4,14 @@ export const AddressV2Schema = z.object({
|
|||
/**
|
||||
* min() to allow empty strings
|
||||
*/
|
||||
companyName: z.string().min(0),
|
||||
cityArea: z.string().min(0),
|
||||
countryArea: z.string().min(0),
|
||||
streetAddress1: z.string().min(0),
|
||||
streetAddress2: z.string().min(0),
|
||||
postalCode: z.string().min(0),
|
||||
city: z.string().min(0),
|
||||
country: z.string().min(0),
|
||||
companyName: z.string().optional(),
|
||||
cityArea: z.string().optional(),
|
||||
countryArea: z.string().optional(),
|
||||
streetAddress1: z.string().optional(),
|
||||
streetAddress2: z.string().optional(),
|
||||
postalCode: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
country: z.string().optional(),
|
||||
});
|
||||
export const AppConfigV2Schema = z.object({
|
||||
channelsOverrides: z.record(AddressV2Schema),
|
||||
|
|
|
@ -181,7 +181,9 @@ export const ConnectedAddressForm = (props: Props) => {
|
|||
push("/configuration");
|
||||
}, [push]);
|
||||
|
||||
if (channelOverrideConfigQuery.isLoading || !addressData) {
|
||||
console.log(addressData);
|
||||
|
||||
if (channelOverrideConfigQuery.isLoading) {
|
||||
return <Text color={"textNeutralSubdued"}>Loading</Text>;
|
||||
}
|
||||
|
||||
|
@ -189,7 +191,7 @@ export const ConnectedAddressForm = (props: Props) => {
|
|||
<AddressForm
|
||||
onCancel={onCancelHandler}
|
||||
onSubmit={submitHandler}
|
||||
address={channelOverrideConfigQuery.data[props.channelSlug]}
|
||||
address={channelOverrideConfigQuery.data![props.channelSlug]}
|
||||
channelSlug={props.channelSlug}
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue