@@ -11,7 +11,7 @@ function createTabObj(title) {
11
11
title,
12
12
// snapshots is an array of ALL state snapshots for the reactime tab working on a specific user application
13
13
snapshots : [ ] ,
14
- index : 0 ,
14
+ index : - 1 ,
15
15
//* this is our pointer so we know what the current state the user is checking (this accounts for time travel aka when user clicks jump on the UI)
16
16
currLocation : null ,
17
17
//* inserting a new property to build out our hierarchy dataset for d3
@@ -68,7 +68,7 @@ chrome.runtime.onConnect.addListener(port => {
68
68
if ( Object . keys ( tabsObj ) . length > 0 ) {
69
69
port . postMessage ( {
70
70
action : 'initialConnectSnapshots' ,
71
- payload : { ... tabsObj , msg : 'connection to devgools made' } ,
71
+ payload : tabsObj ,
72
72
} ) ;
73
73
}
74
74
@@ -104,7 +104,7 @@ chrome.runtime.onConnect.addListener(port => {
104
104
// reassigning pointer to the appropriate node to branch off of
105
105
tabsObj [ tabId ] . currLocation = tabsObj [ tabId ] . hierarchy ;
106
106
// reset index
107
- tabsObj [ tabId ] . index = 1 ;
107
+ tabsObj [ tabId ] . index = 0 ;
108
108
return ;
109
109
case 'setLock' :
110
110
tabsObj [ tabId ] . mode . locked = payload ;
@@ -124,7 +124,6 @@ chrome.runtime.onConnect.addListener(port => {
124
124
125
125
// background.js recieves message from contentScript.js
126
126
chrome . runtime . onMessage . addListener ( ( request , sender ) => {
127
- console . log ( 'received request' , request ) ;
128
127
// IGNORE THE AUTOMATIC MESSAGE SENT BY CHROME WHEN CONTENT SCRIPT IS FIRST LOADED
129
128
if ( request . type === 'SIGN_CONNECT' ) return ;
130
129
const tabTitle = sender . tab . title ;
@@ -146,12 +145,10 @@ chrome.runtime.onMessage.addListener((request, sender) => {
146
145
147
146
switch ( action ) {
148
147
case 'jumpToSnap' : {
149
- console . log ( "im triggered" )
150
148
changeCurrLocation ( tabsObj [ tabId ] , tabsObj [ tabId ] . hierarchy , index ) ;
151
149
break ;
152
150
}
153
151
case 'tabReload' : {
154
- console . log ( "tabreload triggered" )
155
152
tabsObj [ tabId ] . mode . locked = false ;
156
153
tabsObj [ tabId ] . mode . paused = false ;
157
154
// dont remove snapshots if persisting
@@ -162,12 +159,12 @@ chrome.runtime.onMessage.addListener((request, sender) => {
162
159
// reassigning pointer to the appropriate node to branch off of
163
160
tabsObj [ tabId ] . currLocation = tabsObj [ tabId ] . hierarchy ;
164
161
// reset index
165
- tabsObj [ tabId ] . index = 1 ;
162
+ tabsObj [ tabId ] . index = 0 ;
166
163
167
164
// send a message to devtools
168
165
portsArr . forEach ( bg => bg . postMessage ( {
169
166
action : 'initialConnectSnapshots' ,
170
- payload : { ... tabsObj , msg : 'reload' } ,
167
+ payload : tabsObj ,
171
168
} ) ) ;
172
169
}
173
170
@@ -189,7 +186,7 @@ chrome.runtime.onMessage.addListener((request, sender) => {
189
186
if ( portsArr . length > 0 ) {
190
187
portsArr . forEach ( bg => bg . postMessage ( {
191
188
action : 'initialConnectSnapshots' ,
192
- payload : { ... tabsObj , msg : 'firstsnapshotreceived' } ,
189
+ payload : tabsObj ,
193
190
} ) ) ;
194
191
}
195
192
break ;
0 commit comments