@@ -37,12 +37,14 @@ import 'core-js';
37
37
// const Tree = require('./tree').default;
38
38
// const componentActionsRecord = require('./masterState');
39
39
40
- import { Snapshot , Mode , SnapshotNode , MsgData , ComponentData , HookStates , Fiber , WorkTag , State } from './types/backendTypes'
40
+ import {
41
+ Snapshot , Mode , SnapshotNode , MsgData , ComponentData , HookStates , Fiber , WorkTag , State
42
+ } from './types/backendTypes' ;
41
43
import Tree from './tree' ;
42
44
import componentActionsRecord from './masterState' ;
43
45
import { throttle , getHooksNames } from './helpers' ;
44
46
45
- let doWork : boolean = true ;
47
+ let doWork = true ;
46
48
const circularComponentTable = new Set ( ) ;
47
49
48
50
// module.exports = (snap, mode) => {
@@ -57,7 +59,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
57
59
snap . tree = new Tree ( 'root' , 'root' ) ;
58
60
}
59
61
const payload = snap . tree . cleanTreeCopy ( ) ; // snap.tree.getCopy();
60
-
62
+
61
63
window . postMessage ( {
62
64
action : 'recordSnap' ,
63
65
payload,
@@ -86,7 +88,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
86
88
}
87
89
88
90
// This runs after every Fiber commit. It creates a new snapshot
89
- function createTree ( currentFiber : Fiber , tree : Tree = new Tree ( 'root' , 'root' ) , fromSibling : boolean = false ) {
91
+ function createTree ( currentFiber : Fiber , tree : Tree = new Tree ( 'root' , 'root' ) , fromSibling = false ) {
90
92
// Base case: child or sibling pointed to null
91
93
if ( ! currentFiber ) return null ;
92
94
if ( ! tree ) return tree ;
@@ -108,7 +110,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
108
110
109
111
let newState : any ;
110
112
let componentData : ComponentData ;
111
- let componentFound : boolean = false ;
113
+ let componentFound = false ;
112
114
113
115
// Check if node is a stateful setState component
114
116
if ( stateNode && stateNode . state && ( tag === 0 || tag === 1 || tag === 2 ) ) {
@@ -144,7 +146,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
144
146
}
145
147
146
148
// This grabs stateless components
147
-
149
+
148
150
if ( ! componentFound && ( tag === 0 || tag === 1 || tag === 2 ) ) {
149
151
newState = 'stateless' ;
150
152
}
@@ -160,7 +162,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
160
162
161
163
let newNode = null ;
162
164
// We want to add this fiber node to the snapshot
163
- const snapshotState = newState . state || newState . hooksState ;
165
+ // const snapshotState = newState.state || newState.hooksState;
164
166
if ( componentFound || newState === 'stateless' ) {
165
167
if ( fromSibling ) {
166
168
newNode = tree . addSibling ( newState ,
@@ -175,7 +177,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
175
177
newNode = tree ;
176
178
}
177
179
178
- // Recurse on children
180
+ // Recurse on children
179
181
if ( child && ! circularComponentTable . has ( child ) ) {
180
182
// If this node had state we appended to the children array,
181
183
// so attach children to the newly appended child.
@@ -206,7 +208,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
206
208
console . log ( 'doWork is:' , doWork ) ;
207
209
}
208
210
209
- return ( ) => {
211
+ return ( ) => {
210
212
/* const container = document.getElementById('root');
211
213
if (container._internalRoot) {
212
214
fiberRoot = container._internalRoot;
@@ -223,7 +225,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
223
225
const reactInstance = devTools ? devTools . renderers . get ( 1 ) : null ;
224
226
fiberRoot = devTools . getFiberRoots ( 1 ) . values ( ) . next ( ) . value ;
225
227
const throttledUpdateSnapshot = throttle ( updateSnapShotTree , 140 ) ;
226
-
228
+
227
229
document . addEventListener ( 'visibilitychange' , onVisibilityChange ) ;
228
230
if ( reactInstance && reactInstance . version ) {
229
231
devTools . onCommitFiberRoot = ( function ( original ) {
0 commit comments