Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit f109374

Browse files
marvinhagemeisterBrian Vaughn
authored andcommitted
Pull memoizedInteractions from DataType instead of Fiber
1 parent 82a8d82 commit f109374

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

agent/Agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ class Agent extends EventEmitter {
380380
this.emit('root', id);
381381
}
382382

383-
rootCommitted(renderer: RendererID, internalInstance: OpaqueNodeHandle) {
383+
rootCommitted(renderer: RendererID, internalInstance: OpaqueNodeHandle, data: DataType) {
384384
var id = this.getId(internalInstance);
385-
this.emit('rootCommitted', id, internalInstance);
385+
this.emit('rootCommitted', id, internalInstance, data);
386386
}
387387

388388
onMounted(renderer: RendererID, component: OpaqueNodeHandle, data: DataType) {

agent/inject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = function(hook: Hook, agent: Agent) {
2828

2929
// Required by Profiler plugin
3030
hook.sub('root', ({renderer, internalInstance}) => agent.addRoot(renderer, internalInstance)),
31-
hook.sub('rootCommitted', ({renderer, internalInstance}) => agent.rootCommitted(renderer, internalInstance)),
31+
hook.sub('rootCommitted', ({renderer, internalInstance, data}) => agent.rootCommitted(renderer, internalInstance, data)),
3232
hook.sub('updateProfileTimes', ({renderer, internalInstance, data}) => agent.onUpdatedProfileTimes(internalInstance, data)),
3333
];
3434

backend/attachRendererFiber.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
184184
var actualDuration = null;
185185
var actualStartTime = null;
186186
var treeBaseDuration = null;
187+
var memoizedInteractions = null;
187188

188189
var resolvedType = type;
189190
if (typeof type === 'object' && type !== null) {
@@ -207,6 +208,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
207208
if (context && Object.keys(context).length === 0) {
208209
context = null;
209210
}
211+
memoizedInteractions = publicInstance.memoizedInteractions;
210212
}
211213
const inst = publicInstance;
212214
if (inst) {
@@ -381,6 +383,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
381383
text,
382384
updater,
383385
publicInstance,
386+
memoizedInteractions,
384387

385388
// Profiler data
386389
actualDuration,
@@ -550,6 +553,7 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
550553
function markRootCommitted(fiber) {
551554
pendingEvents.push({
552555
internalInstance: getOpaqueNode(fiber),
556+
data: getDataFiber(fiber),
553557
renderer: rid,
554558
type: 'rootCommitted',
555559
});

plugins/Profiler/ProfileCollector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class ProfileCollector {
4848
}
4949

5050
_takeCommitSnapshotForRoot(id: string, data: any) {
51-
const interactionsArray = data.stateNode.memoizedInteractions != null
52-
? Array.from(data.stateNode.memoizedInteractions)
51+
const interactionsArray = data.memoizedInteractions != null
52+
? Array.from(data.memoizedInteractions)
5353
: [];
5454

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

98-
_onRootCommitted = (id: string, data: any) => {
98+
_onRootCommitted = (id: string, internalInstance: any, data: any) => {
9999
if (!this._isRecording) {
100100
return;
101101
}

0 commit comments

Comments
 (0)