Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions agent/Agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ class Agent extends EventEmitter {
this.emit('root', id);
}

rootCommitted(renderer: RendererID, internalInstance: OpaqueNodeHandle) {
rootCommitted(renderer: RendererID, internalInstance: OpaqueNodeHandle, data: DataType) {
var id = this.getId(internalInstance);
this.emit('rootCommitted', id, internalInstance);
this.emit('rootCommitted', id, internalInstance, data);
}

onMounted(renderer: RendererID, component: OpaqueNodeHandle, data: DataType) {
Expand Down
2 changes: 1 addition & 1 deletion agent/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function(hook: Hook, agent: Agent) {

// Required by Profiler plugin
hook.sub('root', ({renderer, internalInstance}) => agent.addRoot(renderer, internalInstance)),
hook.sub('rootCommitted', ({renderer, internalInstance}) => agent.rootCommitted(renderer, internalInstance)),
hook.sub('rootCommitted', ({renderer, internalInstance, data}) => agent.rootCommitted(renderer, internalInstance, data)),
hook.sub('updateProfileTimes', ({renderer, internalInstance, data}) => agent.onUpdatedProfileTimes(internalInstance, data)),
];

Expand Down
4 changes: 4 additions & 0 deletions backend/attachRendererFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
var actualDuration = null;
var actualStartTime = null;
var treeBaseDuration = null;
var memoizedInteractions = null;

var resolvedType = type;
if (typeof type === 'object' && type !== null) {
Expand All @@ -181,6 +182,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
if (context && Object.keys(context).length === 0) {
context = null;
}
memoizedInteractions = publicInstance.memoizedInteractions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be setting this for the HostRoot tag type actually. I can make this change.

}
const inst = publicInstance;
if (inst) {
Expand Down Expand Up @@ -355,6 +357,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
text,
updater,
publicInstance,
memoizedInteractions,

// Profiler data
actualDuration,
Expand Down Expand Up @@ -524,6 +527,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
function markRootCommitted(fiber) {
pendingEvents.push({
internalInstance: getOpaqueNode(fiber),
data: getDataFiber(fiber),
renderer: rid,
type: 'rootCommitted',
});
Expand Down
6 changes: 3 additions & 3 deletions plugins/Profiler/ProfileCollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class ProfileCollector {
}

_takeCommitSnapshotForRoot(id: string, data: any) {
const interactionsArray = data.stateNode.memoizedInteractions != null
? Array.from(data.stateNode.memoizedInteractions)
const interactionsArray = data.memoizedInteractions != null
? Array.from(data.memoizedInteractions)
: [];

// Map interaction start times to when we started profiling.
Expand Down Expand Up @@ -95,7 +95,7 @@ class ProfileCollector {
this._maxActualDuration = Math.max(this._maxActualDuration, data.actualDuration);
};

_onRootCommitted = (id: string, data: any) => {
_onRootCommitted = (id: string, internalInstance: any, data: any) => {
if (!this._isRecording) {
return;
}
Expand Down