File tree 1 file changed +6
-4
lines changed
src/utils/stateManagement
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) {
6
6
{
7
7
const { openTabIDs : arr } = state , removedItemIndex = arr . indexOf ( action . tabId ) ;
8
8
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 } ;
11
12
}
12
13
return state ;
13
14
}
14
15
case actions . open :
15
16
{
16
17
const arr = state . openTabIDs , tabId = action . tabId ;
17
18
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 } ;
20
22
}
21
23
return state ;
22
24
}
You can’t perform that action at this time.
0 commit comments