Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update cache after address removal

dominik-zeglen2c0ae341e7d2
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 3b8cf7d310..c4dfdef138 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -28,6 +28,7 @@ type AddressCreate {
type AddressDelete {
errors: [Error!]
+ user: User
address: Address
}
diff --git a/saleor/static/dashboard-next/customers/mutations.ts b/saleor/static/dashboard-next/customers/mutations.ts
index af81660b95..a2ef027b00 100644
--- a/saleor/static/dashboard-next/customers/mutations.ts
+++ b/saleor/static/dashboard-next/customers/mutations.ts
@@ -150,15 +150,16 @@ export const TypedUpdateCustomerAddressMutation = TypedMutation<
>(updateCustomerAddress);
const removeCustomerAddress = gql`
+ ${customerAddressesFragment}
mutation RemoveCustomerAddress($id: ID!) {
addressDelete(id: $id) {
errors {
field
message
}
- # user {
- # ...CustomerAddressesFragment
- # }
+ user {
+ ...CustomerAddressesFragment
+ }
}
}
`;
diff --git a/saleor/static/dashboard-next/customers/types/RemoveCustomerAddress.ts b/saleor/static/dashboard-next/customers/types/RemoveCustomerAddress.ts
index 674ac638cc..a4f6cd9eeb 100644
--- a/saleor/static/dashboard-next/customers/types/RemoveCustomerAddress.ts
+++ b/saleor/static/dashboard-next/customers/types/RemoveCustomerAddress.ts
@@ -12,9 +12,53 @@ export interface RemoveCustomerAddress_addressDelete_errors {
message: string | null;
}
+export interface RemoveCustomerAddress_addressDelete_user_addresses_country {
+ __typename: "CountryDisplay";
+ code: string;
+ country: string;
+}
+
+export interface RemoveCustomerAddress_addressDelete_user_addresses {
+ __typename: "Address";
+ city: string;
+ cityArea: string;
+ companyName: string;
+ country: RemoveCustomerAddress_addressDelete_user_addresses_country;
+ countryArea: string;
+ firstName: string;
+ id: string;
+ lastName: string;
+ phone: string | null;
+ postalCode: string;
+ streetAddress1: string;
+ streetAddress2: string;
+}
+
+export interface RemoveCustomerAddress_addressDelete_user_defaultBillingAddress {
+ __typename: "Address";
+ id: string;
+}
+
+export interface RemoveCustomerAddress_addressDelete_user_defaultShippingAddress {
+ __typename: "Address";
+ id: string;
+}
+
+export interface RemoveCustomerAddress_addressDelete_user {
+ __typename: "User";
+ id: string;
+ email: string;
+ firstName: string;
+ lastName: string;
+ addresses: (RemoveCustomerAddress_addressDelete_user_addresses | null)[] | null;
+ defaultBillingAddress: RemoveCustomerAddress_addressDelete_user_defaultBillingAddress | null;
+ defaultShippingAddress: RemoveCustomerAddress_addressDelete_user_defaultShippingAddress | null;
+}
+
export interface RemoveCustomerAddress_addressDelete {
__typename: "AddressDelete";
errors: RemoveCustomerAddress_addressDelete_errors[] | null;
+ user: RemoveCustomerAddress_addressDelete_user | null;
}
export interface RemoveCustomerAddress {
diff --git a/saleor/static/dashboard-next/customers/views/CustomerAddresses.tsx b/saleor/static/dashboard-next/customers/views/CustomerAddresses.tsx
index b78b1e6646..d248300171 100644
--- a/saleor/static/dashboard-next/customers/views/CustomerAddresses.tsx
+++ b/saleor/static/dashboard-next/customers/views/CustomerAddresses.tsx
@@ -135,12 +135,7 @@ const CustomerAddresses: React.FC<CustomerAddressesProps> = ({ id }) => {
return (
<>
<WindowTitle
- title={maybe(() =>
- i18n.t("{{ firstName }} {{ lastName }}", {
- firstName: customerData.data.user.firstName,
- lastName: customerData.data.user.lastName
- })
- )}
+ title={maybe(() => customerData.data.user.email)}
/>
<CustomerAddressListPage
customer={maybe(() => customerData.data.user)}