Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
add missing default state for useReducer hook
Browse files Browse the repository at this point in the history
  • Loading branch information
nerrad committed Feb 27, 2020
1 parent 70aca65 commit 964236a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/js/base/context/cart-checkout/checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const CheckoutProvider = ( {
// the redirectUrl for when checkout is reset to PRISTINE state.
DEFAULT_STATE.redirectUrl = redirectUrl;
const [ checkoutState, dispatch ] = useReducer( reducer, DEFAULT_STATE );
const [ observers, subscriber ] = useReducer( emitReducer );
const [ observers, subscriber ] = useReducer( emitReducer, {} );
const currentObservers = useRef( observers );
// set observers on ref so it's always current
useEffect( () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const ShippingMethodDataProvider = ( { children } ) => {
errorStatusReducer,
NONE
);
const [ observers, subscriber ] = useReducer( emitReducer );
const [ observers, subscriber ] = useReducer( emitReducer, {} );
const [ currentShippingAddress, setAddressState ] = useState(
DEFAULT_SHIPPING_ADDRESS
);
Expand Down Expand Up @@ -140,7 +140,7 @@ export const ShippingMethodDataProvider = ( { children } ) => {
);
} else if ( ! shippingOptionsLoading && shippingOptions ) {
emitEvent(
currentObservers.observers,
currentObservers.current,
EMIT_TYPES.SHIPPING_RATES_SUCCESS,
shippingOptions
);
Expand Down

0 comments on commit 964236a

Please sign in to comment.