@@ -357,7 +357,8 @@ function createTree(
357
357
// time-travel state changing. Add record index to snapshot so we can retrieve.
358
358
componentData . index = componentActionsRecord . saveNew (
359
359
stateNode . state ,
360
- stateNode
360
+ stateNode ,
361
+ currentFiber . elementType . name ,
361
362
) ;
362
363
newState = stateNode . state ;
363
364
componentFound = true ;
@@ -367,32 +368,32 @@ function createTree(
367
368
atomArray . push ( memoizedProps ) ;
368
369
369
370
// RECOIL HOOKS
370
- if (
371
- memoizedState
372
- && ( tag === 0 || tag === 1 || tag === 2 || tag === 10 )
373
- ) {
374
- if ( memoizedState . queue ) {
375
- // Hooks states are stored as a linked list using memoizedState.next,
376
- // so we must traverse through the list and get the states.
377
- // We then store them along with the corresponding memoizedState.queue,
378
- // which includes the dispatch() function we use to change their state.
379
- const hooksStates = traverseRecoilHooks ( memoizedState , memoizedProps ) ;
380
- hooksStates . forEach ( ( state , i ) => {
381
- hooksIndex = componentActionsRecord . saveNew (
382
- state . state ,
383
- state . component
384
- ) ;
385
- componentData . hooksIndex = hooksIndex ;
386
- if ( ! newState ) {
387
- newState = { hooksState : [ ] } ;
388
- } else if ( ! newState . hooksState ) {
389
- newState . hooksState = [ ] ;
390
- }
391
- newState . hooksState . push ( { [ i ] : state . state } ) ;
392
- componentFound = true ;
393
- } ) ;
394
- }
395
- }
371
+ // if (
372
+ // memoizedState
373
+ // && (tag === 0 || tag === 1 || tag === 2 || tag === 10)
374
+ // ) {
375
+ // if (memoizedState.queue) {
376
+ // // Hooks states are stored as a linked list using memoizedState.next,
377
+ // // so we must traverse through the list and get the states.
378
+ // // We then store them along with the corresponding memoizedState.queue,
379
+ // // which includes the dispatch() function we use to change their state.
380
+ // const hooksStates = traverseRecoilHooks(memoizedState, memoizedProps);
381
+ // hooksStates.forEach((state, i) => {
382
+ // hooksIndex = componentActionsRecord.saveNew(
383
+ // state.state,
384
+ // state.component
385
+ // );
386
+ // componentData.hooksIndex = hooksIndex;
387
+ // if (!newState) {
388
+ // newState = { hooksState: [] };
389
+ // } else if (!newState.hooksState) {
390
+ // newState.hooksState = [];
391
+ // }
392
+ // newState.hooksState.push({ [i]: state.state });
393
+ // componentFound = true;
394
+ // });
395
+ // }
396
+ // }
396
397
397
398
// Check if node is a hooks useState function
398
399
// REGULAR REACT HOOKS
@@ -412,7 +413,8 @@ function createTree(
412
413
hooksStates . forEach ( ( state , i ) => {
413
414
hooksIndex = componentActionsRecord . saveNew (
414
415
state . state ,
415
- state . component
416
+ state . component ,
417
+ currentFiber . elementType . name ,
416
418
) ;
417
419
componentData . hooksIndex = hooksIndex ;
418
420
if ( ! newState ) {
0 commit comments