Skip to content

Commit e04cb8a

Browse files
udpate helper.getCopyState
1 parent 5bdcf34 commit e04cb8a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/utils/helper.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ helper.checkArrIndex = (index, arrLength) => index >= 0 && (index < arrLength);
33
helper.getInstance = function (Fn) { new (Function.prototype.bind.apply(Fn, arguments)); };
44
helper.resolve = result => Promise.resolve(result);
55
helper.getCopyState = function (state) {
6-
const newState = { ...state };
7-
if (newState.hasOwnProperty('openTabIDs'))
8-
newState.openTabIDs = [...newState.openTabIDs];
9-
return newState;
6+
if (!state.hasOwnProperty('openTabIDs'))
7+
state.openTabIDs = [];
8+
return {
9+
selectedTabID: state.selectedTabID,
10+
openTabIDs: [...state.openTabIDs]
11+
};
1012
};
1113
helper.assingAll = function (targetObj, ...sourcObjs) {
1214
// copy all enumerable and not enumerable properties into the target

0 commit comments

Comments
 (0)