@@ -201,15 +201,16 @@ export const mainSlice = createSlice({
201
201
tabs [ currentTab ] . viewIndex = viewIndex === action . payload ? - 1 : action . payload ;
202
202
} ,
203
203
204
- changeSlider : ( state , action ) => { //should really be called jump to snapshot
204
+ changeSlider : ( state , action ) => {
205
+ //should really be called jump to snapshot
205
206
const { port, currentTab, tabs } = state ;
206
207
const { hierarchy, snapshots } = tabs [ currentTab ] || { } ;
207
208
208
209
// finds the name by the action.payload parsing through the hierarchy to send to background.js the current name in the jump action
209
210
const nameFromIndex = findName ( action . payload , hierarchy ) ;
210
211
// nameFromIndex is a number based on which jump button is pushed
211
212
212
- console . log ( " changeSlider to " , action . payload ) ;
213
+ console . log ( ' changeSlider to ' , action . payload ) ;
213
214
214
215
port . postMessage ( {
215
216
action : 'jumpToSnap' ,
@@ -451,7 +452,15 @@ export const mainSlice = createSlice({
451
452
452
453
toggleExpanded : ( state , action ) => {
453
454
const { tabs, currentTab } = state ;
454
- // find correct node from currLocation and toggle isExpanded
455
+ const snapshot = tabs [ currentTab ] . currLocation . stateSnapshot ;
456
+
457
+ // Special case for root node
458
+ if ( action . payload . name === 'root' && snapshot . name === 'root' ) {
459
+ snapshot . isExpanded = ! snapshot . isExpanded ;
460
+ return ;
461
+ }
462
+
463
+ // Regular case for other nodes
455
464
const checkChildren = ( node ) => {
456
465
if ( _ . isEqual ( node , action . payload ) ) {
457
466
node . isExpanded = ! node . isExpanded ;
@@ -461,7 +470,7 @@ export const mainSlice = createSlice({
461
470
} ) ;
462
471
}
463
472
} ;
464
- checkChildren ( tabs [ currentTab ] . currLocation . stateSnapshot ) ;
473
+ checkChildren ( snapshot ) ;
465
474
} ,
466
475
467
476
deleteSeries : ( state ) => {
0 commit comments