Skip to content

Commit e829e19

Browse files
committed
remove unnecessary tests, parse methods in snapShots maintained
1 parent 1f853c7 commit e829e19

File tree

1 file changed

+1
-39
lines changed

1 file changed

+1
-39
lines changed

src/backend/routers/snapShot.ts

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,7 @@ const _ = require('lodash');
1414
*/
1515
// updating tree depending on current mode on the panel (pause, etc)
1616
export default function updateAndSendSnapShotTree(fiberRoot: FiberRoot): void {
17-
18-
// This function compares trees with one another
19-
function isIdentical(tree1, tree2) {
20-
// Check if both are null
21-
if (!tree1 && !tree2) return true;
22-
23-
// Check if either of them is null
24-
if (!tree1 || !tree2) return false;
25-
26-
// Get the keys
27-
const tree1Keys = Object.keys(tree1);
28-
const tree2Keys = Object.keys(tree2);
29-
30-
// Check if length of keys is different
31-
if (tree1Keys.length !== tree2Keys.length) return false;
32-
33-
// Check keys and values
34-
for (let key of tree1Keys) {
35-
const val1 = tree1[key];
36-
const val2 = tree2[key];
37-
38-
const areObjects = isObject(val1) && isObject(val2);
39-
if (
40-
(areObjects && !isIdentical(val1, val2)) ||
41-
(!areObjects && val1 !== val2)
42-
) {
43-
return false;
44-
}
45-
}
46-
return true;
47-
}
48-
49-
function isObject(object) {
50-
return object != null && typeof object === 'object';
51-
}
52-
17+
5318
// This is the currently active root fiber(the mutable root of the tree)
5419
const { current } = fiberRoot;
5520
// Clear all of the legacy actions from old fiber tree because we are about to create a new one
@@ -66,9 +31,6 @@ export default function updateAndSendSnapShotTree(fiberRoot: FiberRoot): void {
6631
// the postMessage action will be received on the content script to later update the tabsObj
6732
// this will fire off everytime there is a change in test application
6833
// convert the payload from a fiber tree to an object to avoid a data clone error when postMessage processes the argument
69-
console.log('This is the payload, baby: ', payload);
70-
const clonedDeepPayload = _.cloneDeep(payload);
71-
console.log('cloneDeepPayload tree', clonedDeepPayload);
7234
// compare payload and clonedDeepPayload with isIdentical
7335
// console.log('are they identical?', isIdentical(payload, clonedDeepPayload));
7436
// console.log('typeof payload', typeof payload);

0 commit comments

Comments
 (0)