File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ module.exports = (snap, mode) => {
52
52
53
53
// redefining the dispatch function so we can inject our code
54
54
component . queue . dispatch = function ( fiber , queue , action ) {
55
+ console . log ( 'mode' , mode ) ;
55
56
if ( mode . locked && ! mode . jumping ) return ;
56
57
oldDispatch ( fiber , queue , action ) ;
57
58
setTimeout ( ( ) => {
@@ -104,7 +105,6 @@ module.exports = (snap, mode) => {
104
105
memoizedState . traversed = traverseHooks ( memoizedState ) ;
105
106
nextTree = tree . appendChild ( memoizedState ) ;
106
107
}
107
-
108
108
// iterate through siblings
109
109
createTree ( sibling , tree ) ;
110
110
// iterate through children
Original file line number Diff line number Diff line change @@ -23,12 +23,20 @@ module.exports = (origin, mode) => {
23
23
} ) ;
24
24
} ) ;
25
25
}
26
- // else {
27
- // // if component uses hooks
28
- // // traverse down the memoize tree again
29
- // console.log('component', originNode.component);
30
- // originNode.component.queue.dispatch(target.state);
31
- // }
26
+ else {
27
+ // if component uses hooks
28
+ // variable for current location
29
+ let currLocation = originNode . component ;
30
+ // state no
31
+ let stateNum = 1 ;
32
+ console . log ( 'component' , originNode . component ) ;
33
+ // while loop through the memoize tree
34
+ while ( currLocation ) {
35
+ currLocation . queue . dispatch ( target . state [ `state${ stateNum } ` ] ) ;
36
+ currLocation = currLocation . next ;
37
+ stateNum += 1 ;
38
+ }
39
+ }
32
40
}
33
41
34
42
return target => {
You can’t perform that action at this time.
0 commit comments