Skip to content

Commit

Permalink
Fix the issue of the saved max shipping time not showing after revisi…
Browse files Browse the repository at this point in the history
…ting the free listings editing page.
  • Loading branch information
eason9487 committed Dec 13, 2024
1 parent ff37b09 commit 63ca753
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/src/data/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ const reducer = ( state = DEFAULT_STATE, action ) => {
}

case TYPES.UPSERT_SHIPPING_TIMES: {
const { countryCodes, time } = action.shippingTime;
const { countryCodes, time, maxTime } = action.shippingTime;
const times = [ ...state.mc.shipping.times ];

countryCodes.forEach( ( countryCode ) => {
const shippingTime = { countryCode, time };
const shippingTime = { countryCode, time, maxTime };
const idx = times.findIndex(
( el ) => el.countryCode === countryCode
);
Expand Down
12 changes: 12 additions & 0 deletions js/src/data/test/reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ describe( 'reducer', () => {
{
countryCode: 'US',
time: 7,
maxTime: 14,
},
{
countryCode: 'CA',
time: 12,
maxTime: 18,
},
],
};
Expand All @@ -278,17 +280,20 @@ describe( 'reducer', () => {
{
countryCode: 'US',
time: 7,
maxTime: 14,
},
{
countryCode: 'CA',
time: 12,
maxTime: 18,
},
] );
const action = {
type: TYPES.UPSERT_SHIPPING_TIMES,
shippingTime: {
countryCodes: [ 'JP', 'CA' ],
time: 15,
maxTime: 30,
},
};
const state = reducer( originalState, action );
Expand All @@ -297,14 +302,17 @@ describe( 'reducer', () => {
{
countryCode: 'US',
time: 7,
maxTime: 14,
},
{
countryCode: 'CA',
time: 15,
maxTime: 30,
},
{
countryCode: 'JP',
time: 15,
maxTime: 30,
},
] );
} );
Expand All @@ -314,14 +322,17 @@ describe( 'reducer', () => {
{
countryCode: 'US',
time: 7,
maxTime: 14,
},
{
countryCode: 'CA',
time: 12,
maxTime: 18,
},
{
countryCode: 'JP',
time: 15,
maxTime: 30,
},
] );
const action = {
Expand All @@ -334,6 +345,7 @@ describe( 'reducer', () => {
{
countryCode: 'CA',
time: 12,
maxTime: 18,
},
] );
} );
Expand Down

0 comments on commit 63ca753

Please sign in to comment.