Remove `setFullAddressPushed` to prevent address continually pushing (https://github.com/woocommerce/woocommerce-blocks/pull/9606)

* Remove fullShippingAddressPushed action/selectors etc from wc/store/cart

* Remove setFullAddressPushed from push-changes
This commit is contained in:
Thomas Roberts 2023-05-30 18:46:18 +03:00 committed by GitHub
parent bc34d9faaf
commit fcedb41bbc
7 changed files with 0 additions and 38 deletions

View File

@ -479,13 +479,6 @@ export const updateCustomerData =
}
};
export const setFullShippingAddressPushed = (
fullShippingAddressPushed: boolean
) => ( {
type: types.SET_FULL_SHIPPING_ADDRESS_PUSHED,
fullShippingAddressPushed,
} );
type Actions =
| typeof addItemToCart
| typeof applyCoupon
@ -506,7 +499,6 @@ type Actions =
| typeof setShippingAddress
| typeof shippingRatesBeingSelected
| typeof updateCustomerData
| typeof setFullShippingAddressPushed
| typeof updatingCustomerData;
export type CartAction = ReturnOrGeneratorYieldUnion< Actions | Thunks >;

View File

@ -100,7 +100,6 @@ export const defaultCartState: CartState = {
applyingCoupon: '',
removingCoupon: '',
isCartDataStale: false,
fullShippingAddressPushed: false,
},
errors: EMPTY_CART_ERRORS,
};

View File

@ -20,7 +20,6 @@ import isShallowEqual from '@wordpress/is-shallow-equal';
import { STORE_KEY } from './constants';
import { VALIDATION_STORE_KEY } from '../validation';
import { processErrorResponse } from '../utils';
import { shippingAddressHasValidationErrors } from './utils';
type CustomerData = {
billingAddress: CartBillingAddress;
@ -212,11 +211,6 @@ const updateCustomerData = debounce( (): void => {
) as BaseAddressKey[] ),
];
}
} )
.finally( () => {
if ( ! shippingAddressHasValidationErrors() ) {
dispatch( STORE_KEY ).setFullShippingAddressPushed( true );
}
} );
}
}, 1000 );

View File

@ -48,15 +48,6 @@ const reducer: Reducer< CartState > = (
action: Partial< CartAction >
) => {
switch ( action.type ) {
case types.SET_FULL_SHIPPING_ADDRESS_PUSHED:
state = {
...state,
metaData: {
...state.metaData,
fullShippingAddressPushed: action.fullShippingAddressPushed,
},
};
break;
case types.SET_ERROR_DATA:
if ( action.error ) {
state = {

View File

@ -9,7 +9,6 @@ import { CartResponse } from '@woocommerce/types';
*/
import { CART_API_ERROR } from './constants';
import type { CartDispatchFromMap, CartResolveSelectFromMap } from './index';
import { shippingAddressHasValidationErrors } from './utils';
/**
* Resolver for retrieving all cart data.
@ -28,10 +27,6 @@ export const getCartData =
receiveError( CART_API_ERROR );
return;
}
if ( ! shippingAddressHasValidationErrors() ) {
dispatch.setFullShippingAddressPushed( true );
}
receiveCart( cartData );
};

View File

@ -222,10 +222,3 @@ export const getItemsPendingQuantityUpdate = ( state: CartState ): string[] => {
export const getItemsPendingDelete = ( state: CartState ): string[] => {
return state.cartItemsPendingDelete;
};
/**
* Whether the address has changes that have not been synced with the server.
*/
export const getFullShippingAddressPushed = ( state: CartState ): boolean => {
return state.metaData.fullShippingAddressPushed;
};

View File

@ -210,8 +210,6 @@ export interface CartMeta {
isCartDataStale: boolean;
applyingCoupon: string;
removingCoupon: string;
/* Whether the full address has been previously pushed to the server */
fullShippingAddressPushed: boolean;
}
export interface ExtensionCartUpdateArgs {
data: Record< string, unknown >;