@@ -305,15 +305,15 @@ export const mainSlice = createSlice({
305305 const { snapshots, sliderIndex} = tabs [ currentTab ] || { } ;
306306
307307 // eslint-disable-next-line max-len
308- // resets name to 0 to send to background.js the current name in the jump action
309- port . postMessage ( {
310- action : 'jumpToSnap' ,
311- index : 0 ,
312- name : 0 ,
313- payload : snapshots [ 0 ] ,
314- tabId : currentTab ,
315- } ) ;
316- tabs [ currentTab ] . sliderIndex = 0 ;
308+ // resets name to 0 to send to background.js the current name in the jump action
309+ port . postMessage ( {
310+ action : 'jumpToSnap' ,
311+ index : 0 ,
312+ name : 0 ,
313+ payload : snapshots [ 0 ] ,
314+ tabId : currentTab ,
315+ } ) ;
316+ tabs [ currentTab ] . sliderIndex = 0 ;
317317 } ,
318318
319319
@@ -323,50 +323,51 @@ export const mainSlice = createSlice({
323323 const { port, tabs, currentTab } = state ;
324324 const { mode} = tabs [ currentTab ] || { } ;
325325 mode [ action . payload ] = ! mode [ action . payload ] ;
326- const newMode = mode [ action . payload ] ;
327- let actionText ;
328- switch ( action . payload ) {
329- case 'paused' :
330- actionText = 'setPause' ;
331- default :
332- }
333- port . postMessage ( {
334- action : actionText ,
335- payload : newMode ,
336- tabId : currentTab ,
337- } ) ;
326+ const newMode = mode [ action . payload ] ;
327+ let actionText ;
328+ switch ( action . payload ) {
329+ case 'paused' :
330+ actionText = 'setPause' ;
331+ default :
332+ }
333+ port . postMessage ( {
334+ action : actionText ,
335+ payload : newMode ,
336+ tabId : currentTab ,
337+ } ) ;
338338 } ,
339339 importSnapshots : ( state , action ) => {
340340 console . log ( 'importSnapshots' )
341341 const { port, tabs, currentTab } = state ;
342- // Log the value of tabs[currentTab].snapshots before the update
343- port . postMessage ( {
344- action : 'import' ,
345- payload : action . payload ,
346- tabId : currentTab ,
347- } ) ;
348-
349- const savedSnapshot = action . payload ;
350-
351- tabs [ currentTab ] . sliderIndex = savedSnapshot . sliderIndex ;
352- tabs [ currentTab ] . viewIndex = savedSnapshot . viewIndex ;
353- tabs [ currentTab ] . playing = false ;
354-
355- // resets hierarchy to page last state recorded
356- tabs [ currentTab ] . hierarchy . stateSnapshot = savedSnapshot . hierarchy . stateSnapshot ;
357-
358- // resets hierarchy
359- tabs [ currentTab ] . hierarchy . children = savedSnapshot . hierarchy . children ;
360-
361- // resets snapshots to page last state recorded
362- tabs [ currentTab ] . snapshots = savedSnapshot . snapshots ;
363-
364- // resets currLocation to page last state recorded
365- tabs [ currentTab ] . currLocation = tabs [ currentTab ] . hierarchy ;
366- tabs [ currentTab ] . index = savedSnapshot . index ;
367- tabs [ currentTab ] . currParent = savedSnapshot . currParent ;
368- tabs [ currentTab ] . currBranch = savedSnapshot . Branch ;
369- tabs [ currentTab ] . seriesSavedStatus = false ;
342+
343+ // Log the value of tabs[currentTab].snapshots before the update
344+ port . postMessage ( {
345+ action : 'import' ,
346+ payload : action . payload ,
347+ tabId : currentTab ,
348+ } ) ;
349+
350+ const savedSnapshot = action . payload ;
351+
352+ tabs [ currentTab ] . sliderIndex = savedSnapshot . sliderIndex ;
353+ tabs [ currentTab ] . viewIndex = savedSnapshot . viewIndex ;
354+ tabs [ currentTab ] . playing = false ;
355+
356+ // resets hierarchy to page last state recorded
357+ tabs [ currentTab ] . hierarchy . stateSnapshot = savedSnapshot . hierarchy . stateSnapshot ;
358+
359+ // resets hierarchy
360+ tabs [ currentTab ] . hierarchy . children = savedSnapshot . hierarchy . children ;
361+
362+ // resets snapshots to page last state recorded
363+ tabs [ currentTab ] . snapshots = savedSnapshot . snapshots ;
364+
365+ // resets currLocation to page last state recorded
366+ tabs [ currentTab ] . currLocation = tabs [ currentTab ] . hierarchy ;
367+ tabs [ currentTab ] . index = savedSnapshot . index ;
368+ tabs [ currentTab ] . currParent = savedSnapshot . currParent ;
369+ tabs [ currentTab ] . currBranch = savedSnapshot . Branch ;
370+ tabs [ currentTab ] . seriesSavedStatus = false ;
370371 } ,
371372 tutorialSaveSeriesToggle : ( state , action ) => {
372373 const { tabs, currentTab } = state ;
0 commit comments