File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/utils/stateManagement Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -6,17 +6,19 @@ export default function reducer(state, action) {
66 {
77 const { openTabIDs : arr } = state , removedItemIndex = arr . indexOf ( action . tabId ) ;
88 if ( removedItemIndex >= 0 ) {
9- arr . splice ( removedItemIndex , 1 ) ;
10- return helper . getCopyState ( state ) ;
9+ const newArr = arr . slice ( ) ;
10+ newArr . splice ( removedItemIndex , 1 ) ;
11+ return { selectedTabID : state . selectedTabID , openTabIDs : newArr } ;
1112 }
1213 return state ;
1314 }
1415 case actions . open :
1516 {
1617 const arr = state . openTabIDs , tabId = action . tabId ;
1718 if ( arr . indexOf ( tabId ) === - 1 ) {
18- arr . push ( tabId ) ;
19- return helper . getCopyState ( state ) ;
19+ const newArr = arr . slice ( ) ;
20+ newArr . push ( tabId ) ;
21+ return { selectedTabID : state . selectedTabID , openTabIDs : newArr } ;
2022 }
2123 return state ;
2224 }
You can’t perform that action at this time.
0 commit comments