Skip to content

Commit a598782

Browse files
committed
grab stateless components too
1 parent bd820f0 commit a598782

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

dev-reactime/linkFiber.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,9 @@ export default (snap, mode) => {
169169
}
170170

171171
// This grabs stateless components
172-
/*
173172
if (!componentFound && (tag === 0 || tag === 1 || tag === 2)) {
174173
newState = 'stateless';
175-
}*/
174+
}
176175

177176
// Adds performance metrics to the component data
178177
componentData = {

src/app/__tests__/Diff.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ describe('Unit testing for Diff.jsx', () => {
2929

3030
useStoreContext.mockImplementation(() => [state]);
3131

32-
let delta = { children: {} }; // expect delta to be an obj
32+
const delta = { children: {} }; // expect delta to be an obj
3333
const html = 'html'; // expect html to be a string
34-
let previous = { state: 'string', children: {} }; // expect previous to be an obj
34+
const previous = { state: 'string', children: {} }; // expect previous to be an obj
3535

3636
beforeEach(() => {
3737
wrapper = shallow(<Diff {...props} />);

src/extension/background.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,26 @@ chrome.runtime.onMessage.addListener((request, sender) => {
276276
firstSnapshotReceived[tabId] = true;
277277
reloaded[tabId] = false;
278278

279+
// if (tabsObj[tabId].snapshots[tabsObj[tabId].snapshots.length - 1]) {
280+
// let sameState = true;
281+
// const testState = (array, compare) => {
282+
// array.forEach((element, elIndex) => {
283+
// const test1 = JSON.stringify(element.state);
284+
// const test2 = JSON.stringify(compare[elIndex].state);
285+
// if (JSON.stringify(element.state) !== JSON.stringify(compare[elIndex].state)) {
286+
// sameState = false;
287+
// }
288+
// if (element.children) {
289+
// testState(element.children, compare[elIndex].children);
290+
// }
291+
// });
292+
// };
293+
// testState(tabsObj[tabId].snapshots[tabsObj[tabId].snapshots.length - 1].children, request.payload.children);
294+
// if (sameState) {
295+
// break;
296+
// }
297+
// }
298+
279299
tabsObj[tabId].snapshots.push(request.payload);
280300

281301
sendToHierarchy(

0 commit comments

Comments
 (0)