@@ -201,15 +201,16 @@ export const mainSlice = createSlice({
201201 tabs [ currentTab ] . viewIndex = viewIndex === action . payload ? - 1 : action . payload ;
202202 } ,
203203
204- changeSlider : ( state , action ) => { //should really be called jump to snapshot
204+ changeSlider : ( state , action ) => {
205+ //should really be called jump to snapshot
205206 const { port, currentTab, tabs } = state ;
206207 const { hierarchy, snapshots } = tabs [ currentTab ] || { } ;
207208
208209 // finds the name by the action.payload parsing through the hierarchy to send to background.js the current name in the jump action
209210 const nameFromIndex = findName ( action . payload , hierarchy ) ;
210211 // nameFromIndex is a number based on which jump button is pushed
211212
212- console . log ( " changeSlider to " , action . payload ) ;
213+ console . log ( ' changeSlider to ' , action . payload ) ;
213214
214215 port . postMessage ( {
215216 action : 'jumpToSnap' ,
@@ -451,7 +452,15 @@ export const mainSlice = createSlice({
451452
452453 toggleExpanded : ( state , action ) => {
453454 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
455464 const checkChildren = ( node ) => {
456465 if ( _ . isEqual ( node , action . payload ) ) {
457466 node . isExpanded = ! node . isExpanded ;
@@ -461,7 +470,7 @@ export const mainSlice = createSlice({
461470 } ) ;
462471 }
463472 } ;
464- checkChildren ( tabs [ currentTab ] . currLocation . stateSnapshot ) ;
473+ checkChildren ( snapshot ) ;
465474 } ,
466475
467476 deleteSeries : ( state ) => {
0 commit comments