@@ -37,12 +37,14 @@ import 'core-js';
3737// const Tree = require('./tree').default;
3838// const componentActionsRecord = require('./masterState');
3939
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' ;
4143import Tree from './tree' ;
4244import componentActionsRecord from './masterState' ;
4345import { throttle , getHooksNames } from './helpers' ;
4446
45- let doWork : boolean = true ;
47+ let doWork = true ;
4648const circularComponentTable = new Set ( ) ;
4749
4850// module.exports = (snap, mode) => {
@@ -57,7 +59,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
5759 snap . tree = new Tree ( 'root' , 'root' ) ;
5860 }
5961 const payload = snap . tree . cleanTreeCopy ( ) ; // snap.tree.getCopy();
60-
62+
6163 window . postMessage ( {
6264 action : 'recordSnap' ,
6365 payload,
@@ -86,7 +88,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
8688 }
8789
8890 // 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 ) {
9092 // Base case: child or sibling pointed to null
9193 if ( ! currentFiber ) return null ;
9294 if ( ! tree ) return tree ;
@@ -108,7 +110,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
108110
109111 let newState : any ;
110112 let componentData : ComponentData ;
111- let componentFound : boolean = false ;
113+ let componentFound = false ;
112114
113115 // Check if node is a stateful setState component
114116 if ( stateNode && stateNode . state && ( tag === 0 || tag === 1 || tag === 2 ) ) {
@@ -144,7 +146,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
144146 }
145147
146148 // This grabs stateless components
147-
149+
148150 if ( ! componentFound && ( tag === 0 || tag === 1 || tag === 2 ) ) {
149151 newState = 'stateless' ;
150152 }
@@ -160,7 +162,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
160162
161163 let newNode = null ;
162164 // We want to add this fiber node to the snapshot
163- const snapshotState = newState . state || newState . hooksState ;
165+ // const snapshotState = newState.state || newState.hooksState;
164166 if ( componentFound || newState === 'stateless' ) {
165167 if ( fromSibling ) {
166168 newNode = tree . addSibling ( newState ,
@@ -175,7 +177,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
175177 newNode = tree ;
176178 }
177179
178- // Recurse on children
180+ // Recurse on children
179181 if ( child && ! circularComponentTable . has ( child ) ) {
180182 // If this node had state we appended to the children array,
181183 // so attach children to the newly appended child.
@@ -206,7 +208,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
206208 console . log ( 'doWork is:' , doWork ) ;
207209 }
208210
209- return ( ) => {
211+ return ( ) => {
210212/* const container = document.getElementById('root');
211213 if (container._internalRoot) {
212214 fiberRoot = container._internalRoot;
@@ -223,7 +225,7 @@ export default (snap: Snapshot, mode: Mode): ()=>void => {
223225 const reactInstance = devTools ? devTools . renderers . get ( 1 ) : null ;
224226 fiberRoot = devTools . getFiberRoots ( 1 ) . values ( ) . next ( ) . value ;
225227 const throttledUpdateSnapshot = throttle ( updateSnapShotTree , 140 ) ;
226-
228+
227229 document . addEventListener ( 'visibilitychange' , onVisibilityChange ) ;
228230 if ( reactInstance && reactInstance . version ) {
229231 devTools . onCommitFiberRoot = ( function ( original ) {
0 commit comments