@@ -38,6 +38,8 @@ export const mainSlice = createSlice({
38
38
//we removed the action parameter because we kept getting an error within actionContainer file on line 204
39
39
//as it expected an argument or payload to be passed in
40
40
emptySnapshots : ( state ) => {
41
+ console . log ( 'emptySnapshots: ' , current ( state ) ) ;
42
+
41
43
const { tabs, currentTab } = state ;
42
44
const { port } = tabs [ currentTab ] || { } ;
43
45
@@ -58,6 +60,9 @@ export const mainSlice = createSlice({
58
60
tabs [ currentTab ] . currParent = 0 ;
59
61
tabs [ currentTab ] . currBranch = 1 ;
60
62
tabs [ currentTab ] . seriesSavedStatus = false ;
63
+
64
+ console . log ( 'emptySnapshots state end: ' , current ( state ) ) ;
65
+
61
66
} ,
62
67
addNewSnapshots : ( state , action ) => {
63
68
console . log ( 'addNewSnapshots: ' , state ) ;
@@ -89,6 +94,8 @@ export const mainSlice = createSlice({
89
94
} ;
90
95
}
91
96
} ) ;
97
+ console . log ( 'addNewSnapshots: state end ' , state ) ;
98
+
92
99
} ,
93
100
initialConnect : ( state , action ) => {
94
101
console . log ( 'initialConnect: ' , current ( state ) ) ;
@@ -111,13 +118,17 @@ export const mainSlice = createSlice({
111
118
// only set first tab if current tab is non existent
112
119
const firstTab = parseInt ( Object . keys ( payload ) [ 0 ] , 10 ) ;
113
120
if ( currentTab === undefined || currentTab === null ) state . currentTab = firstTab ;
114
-
121
+ console . log ( 'initialConnect: state end' , current ( state ) ) ;
122
+
115
123
} ,
116
124
setPort : ( state , action ) => {
117
125
console . log ( 'setPort: ' , current ( state ) ) ;
118
126
console . log ( 'ACTION' , action ) ;
119
127
120
128
state . port = action . payload ;
129
+
130
+ console . log ( 'setPort: state end' , current ( state ) ) ;
131
+
121
132
} ,
122
133
setTab : ( state , action ) => {
123
134
console . log ( 'setTab: ' , current ( state ) ) ;
@@ -133,10 +144,14 @@ export const mainSlice = createSlice({
133
144
state . currentTitle = action . payload . title ;
134
145
} ;
135
146
}
147
+ console . log ( 'setTab: state end' , current ( state ) ) ;
148
+
136
149
} ,
137
150
deleteTab : ( state , action ) => {
138
151
console . log ( 'deleteTab: ' , current ( state ) ) ;
139
152
delete state . tabs [ action . payload ] ;
153
+ console . log ( 'deleteTab: state end' , current ( state ) ) ;
154
+
140
155
} ,
141
156
noDev : ( state , action ) => {
142
157
console . log ( 'noDev: ' , current ( state ) ) ;
@@ -146,6 +161,8 @@ export const mainSlice = createSlice({
146
161
const { reactDevToolsInstalled } = payload [ currentTab ] . status ;
147
162
tabs [ currentTab ] . status . reactDevToolsInstalled = reactDevToolsInstalled
148
163
}
164
+ console . log ( 'noDev: state end' , current ( state ) ) ;
165
+
149
166
} ,
150
167
setCurrentLocation : ( state , action ) => {
151
168
console . log ( 'setCurrentLocation: ' , current ( state ) ) ;
@@ -164,15 +181,21 @@ export const mainSlice = createSlice({
164
181
tabs [ currentTab ] . currLocation . stateSnapshot ,
165
182
) ;
166
183
tabs [ currentTab ] . currLocation = payload [ currentTab ] . currLocation ;
184
+ console . log ( 'setCurrentLocation: state end' , current ( state ) ) ;
185
+
167
186
} ,
168
187
changeView : ( state , action ) => {
188
+ console . log ( 'changeView: ' , current ( state ) ) ;
189
+
169
190
const { tabs, currentTab} = state ;
170
191
const { viewIndex} = tabs [ currentTab ] || { } ;
171
192
172
193
tabs [ currentTab ] . viewIndex = viewIndex === action . payload ? - 1 : action . payload ;
194
+ console . log ( 'changeView: state end' , current ( state ) ) ;
195
+
173
196
} ,
174
197
changeSlider : ( state , action ) => {
175
- console . log ( 'CHANGE SLIDER' ) ;
198
+ console . log ( 'changeSlider: ' , current ( state ) ) ;
176
199
const { port, currentTab, tabs } = state ;
177
200
const { hierarchy, snapshots } = tabs [ currentTab ] || { } ;
178
201
@@ -187,10 +210,14 @@ export const mainSlice = createSlice({
187
210
} ) ;
188
211
189
212
tabs [ currentTab ] . sliderIndex = action . payload ;
213
+ console . log ( 'changeSlider: state end' , current ( state ) ) ;
214
+
190
215
} ,
191
216
setCurrentTabInApp : ( state , action ) => {
192
- console . log ( 'SET CURRENT TAB IN APP' ) ;
217
+ console . log ( 'setCurrentTabInApp: ' , current ( state ) ) ;
193
218
state . currentTabInApp = action . payload ;
219
+ console . log ( 'setCurrentTabInApp: state end' , current ( state ) ) ;
220
+
194
221
} ,
195
222
pause : ( state ) => {
196
223
console . log ( 'pause: ' , current ( state ) ) ;
@@ -201,6 +228,8 @@ export const mainSlice = createSlice({
201
228
clearInterval ( intervalId ) ;
202
229
tabs [ currentTab ] . playing = false ;
203
230
tabs [ currentTab ] . intervalId = null ;
231
+ console . log ( 'pause: state end' , current ( state ) ) ;
232
+
204
233
} ,
205
234
launchContentScript : ( state , action ) => {
206
235
console . log ( 'launchContentScript: ' , current ( state ) ) ;
@@ -214,8 +243,12 @@ export const mainSlice = createSlice({
214
243
payload : action . payload ,
215
244
tabId : currentTab ,
216
245
} ) ;
246
+ console . log ( 'launchContentScript: state end' , current ( state ) ) ;
247
+
217
248
} ,
218
249
playForward : ( state , action ) => {
250
+ console . log ( 'playForward: ' , current ( state ) ) ;
251
+
219
252
const { port, tabs, currentTab} = state
220
253
const { hierarchy, snapshots, sliderIndex, intervalId } = tabs [ currentTab ] || { } ;
221
254
@@ -241,14 +274,21 @@ export const mainSlice = createSlice({
241
274
tabs [ currentTab ] . playing = false ;
242
275
}
243
276
}
277
+ console . log ( 'playForward: state end' , current ( state ) ) ;
278
+
244
279
} ,
245
280
startPlaying : ( state , action ) => {
246
- const { tabs , currentTab } = state
281
+ console . log ( 'startPlaying: ' , current ( state ) ) ;
247
282
283
+ const { tabs, currentTab} = state
248
284
tabs [ currentTab ] . playing = true ;
249
285
tabs [ currentTab ] . intervalId = action . payload ;
286
+ console . log ( 'startPlaying: state end' , current ( state ) ) ;
287
+
250
288
} ,
251
289
moveForward : ( state , action ) => {
290
+ console . log ( 'moveForward: ' , current ( state ) ) ;
291
+
252
292
const { port, tabs, currentTab} = state
253
293
const { hierarchy, snapshots, sliderIndex, intervalId } = tabs [ currentTab ] || { } ;
254
294
@@ -274,8 +314,12 @@ export const mainSlice = createSlice({
274
314
tabs [ currentTab ] . playing = false ;
275
315
}
276
316
}
317
+ console . log ( 'moveForward: state end' , current ( state ) ) ;
318
+
277
319
} ,
278
320
moveBackward : ( state , action ) => {
321
+ console . log ( 'moveBackward: ' , current ( state ) ) ;
322
+
279
323
const { port, tabs, currentTab} = state
280
324
const { hierarchy, snapshots, sliderIndex, intervalId } = tabs [ currentTab ] || { } ;
281
325
@@ -298,46 +342,58 @@ export const mainSlice = createSlice({
298
342
tabs [ currentTab ] . sliderIndex = newIndex ;
299
343
tabs [ currentTab ] . playing = false ;
300
344
}
345
+ console . log ( 'moveBackward: state end' , current ( state ) ) ;
346
+
301
347
} ,
302
348
303
349
resetSlider : ( state ) => {
350
+ console . log ( 'resetSlider: ' , current ( state ) ) ;
351
+
304
352
const { port, tabs, currentTab} = state
305
353
const { snapshots, sliderIndex} = tabs [ currentTab ] || { } ;
306
354
307
355
// 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 ;
356
+ // resets name to 0 to send to background.js the current name in the jump action
357
+ port . postMessage ( {
358
+ action : 'jumpToSnap' ,
359
+ index : 0 ,
360
+ name : 0 ,
361
+ payload : snapshots [ 0 ] ,
362
+ tabId : currentTab ,
363
+ } ) ;
364
+ tabs [ currentTab ] . sliderIndex = 0 ;
365
+ console . log ( 'resetSlider: state end' , current ( state ) ) ;
366
+
367
+
317
368
} ,
318
369
319
370
320
371
321
372
toggleMode : ( state , action ) => {
322
- console . log ( 'Toggle Mode' )
373
+ console . log ( 'Toggle Mode: ' , current ( state ) ) ;
374
+
323
375
const { port, tabs, currentTab } = state ;
324
376
const { mode} = tabs [ currentTab ] || { } ;
325
377
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
- } ) ;
378
+ const newMode = mode [ action . payload ] ;
379
+ let actionText ;
380
+ switch ( action . payload ) {
381
+ case 'paused' :
382
+ actionText = 'setPause' ;
383
+ default :
384
+ }
385
+ port . postMessage ( {
386
+ action : actionText ,
387
+ payload : newMode ,
388
+ tabId : currentTab ,
389
+ } ) ;
390
+ console . log ( 'Toggle Mode: state end' , current ( state ) ) ;
391
+
392
+
338
393
} ,
339
394
importSnapshots : ( state , action ) => {
340
- console . log ( 'importSnapshots' )
395
+ console . log ( 'importSnapshots: ' , current ( state ) ) ;
396
+
341
397
const { port, tabs, currentTab } = state ;
342
398
343
399
// Log the value of tabs[currentTab].snapshots before the update
@@ -368,6 +424,8 @@ export const mainSlice = createSlice({
368
424
tabs [ currentTab ] . currParent = savedSnapshot . currParent ;
369
425
tabs [ currentTab ] . currBranch = savedSnapshot . Branch ;
370
426
tabs [ currentTab ] . seriesSavedStatus = false ;
427
+ console . log ( 'importSnapshots: state end' , current ( state ) ) ;
428
+
371
429
} ,
372
430
tutorialSaveSeriesToggle : ( state , action ) => {
373
431
const { tabs, currentTab } = state ;
0 commit comments