@@ -43,7 +43,6 @@ declare global {
43
43
let fiberRoot = null ;
44
44
let doWork = true ;
45
45
const circularComponentTable = new Set ( ) ;
46
- const isRecoil = false ;
47
46
let initialstart = false ;
48
47
let rtidCounter = 0 ;
49
48
let rtid = null ;
@@ -66,13 +65,6 @@ function sendSnapshot(snap: Snapshot, mode: Mode): void {
66
65
}
67
66
const payload = snap . tree . cleanTreeCopy ( ) ;
68
67
payload . route = routes . addRoute ( window . location . href ) ;
69
- // if it's Recoil - run different actions
70
- if ( isRecoil ) {
71
- // getRecoilState()
72
- payload . atomsComponents = atomsComponents ;
73
- payload . atomSelectors = atomsSelectors ;
74
- payload . recoilDomNode = recoilDomNode ;
75
- }
76
68
// method safely enables cross-origin communication between Window objects;
77
69
// e.g., between a page and a pop-up that it spawned, or between a page
78
70
// and an iframe embedded within it.
@@ -258,53 +250,6 @@ function createTree(
258
250
}
259
251
}
260
252
261
- // Checks Recoil Atom and Selector Relationships
262
- if (
263
- currentFiber . memoizedState
264
- && currentFiber . memoizedState . next
265
- && currentFiber . memoizedState . next . memoizedState
266
- && currentFiber . memoizedState . next . memoizedState . deps
267
- && isRecoil
268
- && currentFiber . tag === 0
269
- && currentFiber . key === null
270
- // prevents capturing the same Fiber nodes but different key values that result from being changed
271
- ) {
272
- let pointer = currentFiber . memoizedState . next ;
273
- const componentName = currentFiber . elementType . name ;
274
-
275
- if ( ! atomsComponents [ componentName ] ) {
276
- atomsComponents [ componentName ] = [ ] ;
277
- while ( pointer !== null ) {
278
- if ( ! Array . isArray ( pointer . memoizedState ) ) {
279
- const atomName = pointer . memoizedState . deps [ 0 ] . key ;
280
- atomsComponents [ componentName ] . push ( atomName ) ;
281
- }
282
- pointer = pointer . next ;
283
- }
284
- }
285
-
286
- if (
287
- currentFiber . memoizedState . next . memoizedState . deps [ 1 ] . current
288
- && ! initialstart
289
- ) {
290
- const getState = currentFiber . memoizedState . next . memoizedState . deps [ 1 ] . current . getState ( )
291
- . graphsByVersion ;
292
- getState . entries ( ) . forEach ( value => {
293
- value [ 1 ] . nodeDeps . entries ( ) . forEach ( obj => {
294
- if ( ! atomsSelectors [ obj [ 0 ] ] ) {
295
- atomsSelectors [ obj [ 0 ] ] = [ ] ;
296
- }
297
- obj [ 1 ] . values ( ) . forEach ( selector => {
298
- if ( ! atomsSelectors [ obj [ 0 ] ] . includes ( selector ) ) {
299
- atomsSelectors [ obj [ 0 ] ] . push ( selector ) ;
300
- }
301
- } ) ;
302
- } ) ;
303
- } ) ;
304
- initialstart = true ;
305
- }
306
- }
307
-
308
253
let newState : any | { hooksState ?: any [ ] } = { } ;
309
254
let componentData : {
310
255
hooksState ?: any [ ] ;
@@ -338,40 +283,11 @@ function createTree(
338
283
const atomArray = [ ] ;
339
284
atomArray . push ( memoizedProps ) ;
340
285
341
- // RECOIL HOOKS
342
- // if (
343
- // memoizedState
344
- // && (tag === 0 || tag === 1 || tag === 2 || tag === 10)
345
- // ) {
346
- // if (memoizedState.queue) {
347
- // // Hooks states are stored as a linked list using memoizedState.next,
348
- // // so we must traverse through the list and get the states.
349
- // // We then store them along with the corresponding memoizedState.queue,
350
- // // which includes the dispatch() function we use to change their state.
351
- // const hooksStates = traverseRecoilHooks(memoizedState, memoizedProps);
352
- // hooksStates.forEach((state, i) => {
353
- // hooksIndex = componentActionsRecord.saveNew(
354
- // state.state,
355
- // state.component
356
- // );
357
- // componentData.hooksIndex = hooksIndex;
358
- // if (!newState) {
359
- // newState = { hooksState: [] };
360
- // } else if (!newState.hooksState) {
361
- // newState.hooksState = [];
362
- // }
363
- // newState.hooksState.push({ [i]: state.state });
364
- // componentFound = true;
365
- // });
366
- // }
367
- // }
368
-
369
286
// Check if node is a hooks useState function
370
287
// REGULAR REACT HOOKS
371
288
if (
372
289
memoizedState
373
290
&& ( tag === 0 || tag === 1 || tag === 2 || tag === 10 )
374
- && isRecoil === false
375
291
) {
376
292
if ( memoizedState . queue ) {
377
293
// Hooks states are stored as a linked list using memoizedState.next,
@@ -417,37 +333,6 @@ function createTree(
417
333
// We want to add this fiber node to the snapshot
418
334
// eslint-disable-next-line no-mixed-operators
419
335
if ( componentFound || newState === 'stateless' && ! newState . hooksState ) {
420
- if ( isRecoil ) {
421
- // do this down below too
422
- if ( currentFiber . elementType . name ) {
423
- if ( ! recoilDomNode [ currentFiber . elementType . name ] ) {
424
- recoilDomNode [ currentFiber . elementType . name ] = [ ] ;
425
- }
426
- }
427
- let pointer = currentFiber ;
428
- // end of repeat code
429
-
430
- while ( pointer !== null ) {
431
- if ( pointer . stateNode !== null ) {
432
- rtid = `fromLinkFiber${ rtidCounter += 1 } ` ;
433
- // rtid = rtidCounter++;
434
- recoilDomNode [ currentFiber . elementType . name ] . push ( rtid ) ;
435
- // check if rtid is already present
436
- // remove existing rtid before adding a new one
437
- if ( pointer . stateNode . classList . length > 0 ) {
438
- const lastClass = pointer . stateNode . classList [
439
- pointer . stateNode . classList . length - 1
440
- ] ;
441
- if ( lastClass . includes ( 'fromLinkFiber' ) ) {
442
- pointer . stateNode . classList . remove ( lastClass ) ;
443
- }
444
- }
445
-
446
- pointer . stateNode . classList . add ( rtid ) ;
447
- }
448
- pointer = pointer . child ;
449
- }
450
- } else {
451
336
if (
452
337
currentFiber . child
453
338
&& currentFiber . child . stateNode
@@ -468,7 +353,6 @@ function createTree(
468
353
currentFiber . child . stateNode . classList . add ( rtid ) ;
469
354
}
470
355
rtidCounter += 1 ;
471
- }
472
356
// checking if tree fromSibling is true
473
357
if ( fromSibling ) {
474
358
newNode = tree . addSibling (
0 commit comments