Skip to content

Commit 7e8e745

Browse files
committed
Revert "useState showing on the tree"
This reverts commit 6870edd.
1 parent 6870edd commit 7e8e745

File tree

2 files changed

+16
-52
lines changed

2 files changed

+16
-52
lines changed

package/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const mode = {
77
};
88

99
const linkFiber = require('./linkFiber')(snapShot, mode);
10-
1110
const timeJump = require('./timeJump')(snapShot, mode);
1211

1312
window.addEventListener('message', ({ data: { action, payload } }) => {

package/linkFiber.js

Lines changed: 16 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable func-names */
21
/* eslint-disable no-use-before-define */
32
/* eslint-disable no-param-reassign */
43
// links component state tree to library
@@ -13,6 +12,7 @@ module.exports = (snap, mode) => {
1312
// DEV: So that when we are jumping to an old snapshot it wouldn't think we want to create new snapshots
1413
if (mode.jumping || mode.paused) return;
1514
const payload = snap.tree.getCopy();
15+
console.log(payload);
1616
// console.log('payload', payload);
1717
window.postMessage({
1818
action: 'recordSnap',
@@ -103,55 +103,20 @@ module.exports = (snap, mode) => {
103103
snap.tree = createTree(current);
104104
}
105105

106-
// return container => {
107-
// // console.log('Container', container);
108-
// const {
109-
// _reactRootContainer: { _internalRoot },
110-
// _reactRootContainer,
111-
// } = container;
112-
// // console.log('Root container', _reactRootContainer);
113-
// // only assign internal root if it actually exists
114-
// fiberRoot = _internalRoot || _reactRootContainer;
115-
// updateSnapShotTree();
116-
117-
// // send the initial snapshot once the content script has started up
118-
// window.addEventListener('message', ({ data: { action } }) => {
119-
// if (action === 'contentScriptStarted') sendSnapshot();
120-
// });
121-
// };
106+
return container => {
107+
// console.log('Container', container);
108+
const {
109+
_reactRootContainer: { _internalRoot },
110+
_reactRootContainer,
111+
} = container;
112+
// console.log('Root container', _reactRootContainer);
113+
// only assign internal root if it actually exists
114+
fiberRoot = _internalRoot || _reactRootContainer;
115+
updateSnapShotTree();
122116

123-
return {
124-
main(container) {
125-
// console.log('Container', container);
126-
const {
127-
_reactRootContainer: { _internalRoot },
128-
_reactRootContainer,
129-
} = container;
130-
// console.log('Root container', _reactRootContainer);
131-
// only assign internal root if it actually exists
132-
fiberRoot = _internalRoot || _reactRootContainer;
133-
updateSnapShotTree();
134-
135-
// send the initial snapshot once the content script has started up
136-
window.addEventListener('message', ({ data: { action } }) => {
137-
if (action === 'contentScriptStarted') sendSnapshot();
138-
});
139-
},
140-
changeUseState(useState) {
141-
return function (initial) {
142-
// running the original useState and storing its result (state and dispatch function)
143-
const toReturn = useState(initial);
144-
console.log(toReturn);
145-
// storing the original dispatch function definition somewhere
146-
const oldDispatch = toReturn[1];
147-
// redefining the dispatch function so we can inject our code
148-
toReturn[1] = function (callback) {
149-
oldDispatch(callback);
150-
updateSnapShotTree();
151-
sendSnapshot();
152-
};
153-
return toReturn;
154-
};
155-
},
117+
// send the initial snapshot once the content script has started up
118+
window.addEventListener('message', ({ data: { action } }) => {
119+
if (action === 'contentScriptStarted') sendSnapshot();
120+
});
156121
};
157-
};
122+
};

0 commit comments

Comments
 (0)