mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
🐛 Fix incorrect param name in reducer utils
This commit is contained in:
parent
650858a50e
commit
4ae61dfb58
1 changed files with 3 additions and 3 deletions
|
@ -30,10 +30,10 @@ const updateObject = ( oldObject, newValues, allowedKeys = {} ) => ( {
|
||||||
* @return {[Function, Function]} An array containing setTransient and setPersistent functions.
|
* @return {[Function, Function]} An array containing setTransient and setPersistent functions.
|
||||||
*/
|
*/
|
||||||
export const createSetters = ( defaultTransient, defaultPersistent ) => {
|
export const createSetters = ( defaultTransient, defaultPersistent ) => {
|
||||||
const setTransient = ( oldState, newValues ) =>
|
const setTransient = ( oldState, newValues = {} ) =>
|
||||||
updateObject( oldState, newValues, defaultTransient );
|
updateObject( oldState, newValues, defaultTransient );
|
||||||
|
|
||||||
const setPersistent = ( oldState, newValues ) => ( {
|
const setPersistent = ( oldState, newValues = {} ) => ( {
|
||||||
...oldState,
|
...oldState,
|
||||||
data: updateObject( oldState.data, newValues, defaultPersistent ),
|
data: updateObject( oldState.data, newValues, defaultPersistent ),
|
||||||
} );
|
} );
|
||||||
|
@ -67,7 +67,7 @@ export const createReducer = (
|
||||||
|
|
||||||
return function reducer( state = initialState, action ) {
|
return function reducer( state = initialState, action ) {
|
||||||
if ( Object.hasOwnProperty.call( handlers, action.type ) ) {
|
if ( Object.hasOwnProperty.call( handlers, action.type ) ) {
|
||||||
return handlers[ action.type ]( state, action.data );
|
return handlers[ action.type ]( state, action.payload ?? {} );
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue