Skip to content

Commit e77094b

Browse files
committed
added getting initial fiberRoot from devtools; fixed bug in ActionContainer that did not display actions when first node does not have children
1 parent 5946430 commit e77094b

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

dev-reactime/linkFiber.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
/* eslint-disable no-param-reassign */
4646

4747
// const Tree = require('./tree').default;
48-
// const componentActionsRecord = require('./masterState');\
48+
// const componentActionsRecord = require('./masterState');
49+
import Tree from './tree';
50+
import componentActionsRecord from './masterState';
4951

5052
const DEBUG_MODE = false;
5153

@@ -57,8 +59,6 @@ console.log = (original => {
5759
}
5860
})(console.log);
5961

60-
import Tree from './tree';
61-
import componentActionsRecord from './masterState';
6262

6363
const circularComponentTable = new Map();
6464

@@ -238,8 +238,8 @@ export default (snap, mode) => {
238238

239239
return async () => {
240240

241-
/*
242-
const container = document.getElementById('root');
241+
242+
/* const container = document.getElementById('root');
243243
if (container._internalRoot) {
244244
fiberRoot = container._internalRoot;
245245
} else {
@@ -249,12 +249,12 @@ export default (snap, mode) => {
249249
} = container;
250250
// Only assign internal root if it actually exists
251251
fiberRoot = _internalRoot || _reactRootContainer;
252-
}*/
253-
252+
}
253+
*/
254254
const devTools = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
255255
const reactInstance = devTools ? devTools.renderers.get(1) : null;
256+
fiberRoot = devTools.getFiberRoots(1).values().next().value;
256257

257-
//// console.log('fiberRoot retrieved:', fiberRoot);
258258
if (reactInstance && reactInstance.version) {
259259
devTools.onCommitFiberRoot = (function (original) {
260260
return function (...args) {

src/app/containers/ActionContainer.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@ function ActionContainer() {
3131
componentName: obj.stateSnapshot.children[0].name,
3232
componentData: JSON.stringify(obj.stateSnapshot.children[0].componentData) === '{}' ? '' : obj.stateSnapshot.children[0].componentData
3333
};
34-
3534
hierarchyArr.push(newObj);
36-
if (obj.children) {
37-
obj.children.forEach(element => {
38-
displayArray(element);
39-
});
40-
}
35+
}
36+
if (obj.children) {
37+
obj.children.forEach(element => {
38+
displayArray(element);
39+
});
4140
}
4241
};
4342
// gabi :: the hierarchy get set on the first click in the page, when page in refreshed we don't have a hierarchy so we need to check if hierarchy was inicialize involk displayArray to display the hierarchy

0 commit comments

Comments
 (0)