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:
parent
bc34d9faaf
commit
fcedb41bbc
|
@ -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 >;
|
||||
|
|
|
@ -100,7 +100,6 @@ export const defaultCartState: CartState = {
|
|||
applyingCoupon: '',
|
||||
removingCoupon: '',
|
||||
isCartDataStale: false,
|
||||
fullShippingAddressPushed: false,
|
||||
},
|
||||
errors: EMPTY_CART_ERRORS,
|
||||
};
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 );
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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 >;
|
||||
|
|
Loading…
Reference in New Issue