Skip to content

Commit f1760d4

Browse files
committed
minor tweaks and removed __test__ for npm
1 parent fe1605d commit f1760d4

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ coverage
88
src/extension/build.zip
99
src/extension/build.crx
1010
src/extension/build/key.pem
11+
package/__tests__

package/linkFiber.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ module.exports = (snap, mode) => {
4646

4747
function changeUseState(component) {
4848
if (component.queue.dispatch.linkFiberChanged) return;
49-
// store the original dispatch function definition
50-
const oldDispatch = component.queue.dispatch.bind(component.queue);;
49+
// store the original dispatch function definition
50+
const oldDispatch = component.queue.dispatch.bind(component.queue);
5151
// redefine the dispatch function so we can inject our code
5252
component.queue.dispatch = (fiber, queue, action) => {
5353
// don't do anything if state is locked
5454
if (mode.locked && !mode.jumping) return;
55-
oldDispatch(fiber, queue, action);
55+
//oldDispatch(fiber, queue, action);
5656
setTimeout(() => {
57+
oldDispatch(fiber, queue, action);
5758
updateSnapShotTree();
5859
sendSnapshot();
5960
}, 100);
@@ -99,7 +100,7 @@ module.exports = (snap, mode) => {
99100
changeSetState(stateNode);
100101
}
101102
// Check if the component uses hooks
102-
if (memoizedState && memoizedState.hasOwnProperty('baseState')) {
103+
if (memoizedState && memoizedState.hasOwnProperty('baseState')) {
103104
// Add a traversed property and initialize to the evaluated result
104105
// of invoking traverseHooks, and reassign nextTree
105106
memoizedState.traversed = traverseHooks(memoizedState);
@@ -112,7 +113,8 @@ module.exports = (snap, mode) => {
112113

113114
return tree;
114115
}
115-
116+
// runs when page initially loads
117+
// but skips 1st hook click
116118
function updateSnapShotTree() {
117119
const { current } = fiberRoot;
118120
snap.tree = createTree(current);
@@ -131,7 +133,7 @@ module.exports = (snap, mode) => {
131133
astHooks = astParser(entryFile);
132134
saveState(astHooks);
133135
}
134-
updateSnapShotTree();
136+
updateSnapShotTree();
135137
// send the initial snapshot once the content script has started up
136138
window.addEventListener('message', ({ data: { action } }) => {
137139
if (action === 'contentScriptStarted') sendSnapshot();

package/masterState.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ module.exports = {
77
for (const key in state) {
88
masterState.push(state[key]);
99
}
10-
},
11-
returnState: () => {
1210
return masterState;
1311
},
12+
returnState: () => masterState
1413
};

package/timeJump.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = (origin, mode) => {
2727
let current = originNode.component;
2828
let index = 0;
2929
const hooks = returnState();
30-
// while loop through the memoize tree
30+
// Iterate through the memoize tree
3131
while (current) {
3232
current.queue.dispatch(target.state[hooks[index]]);
3333
// Reassign the current value

0 commit comments

Comments
 (0)