@samitouri / QOS-React-2 / commits / e050529c7d

Read renderer ID from operations

Dan Abramov committed Apr 24, 2019 at 15:00 UTC e050529c7d54af391330c991817c614ee6ef66dd
2 files changed +4 -14
src/backend/agent.js
+2 -6
@@ -29,11 +29,6 @@ const debug = (methodName, ...args) => {
29 }
30 };
31
32 -type OperationsParams = {|
33 - operations: Uint32Array,
34 - rendererID: number,
35 -|};
36 -
32 type InspectSelectParams = {|
33 id: number,
34 rendererID: number,
@@ -505,7 +500,7 @@ export default class Agent extends EventEmitter {
500 }
501 };
502
508 - onHookOperations = ({ operations, rendererID }: OperationsParams) => {
503 + onHookOperations = (operations: Uint32Array) => {
504 if (__DEBUG__) {
505 debug('onHookOperations', operations);
506 }
@@ -533,6 +528,7 @@ export default class Agent extends EventEmitter {
528 this._bridge.send('operations', operations);
529
530 if (this._persistedSelection !== null) {
531 + const rendererID = operations[0];
532 if (this._persistedSelection.rendererID === rendererID) {
533 // Check if we can select a deeper match for the persisted selection.
534 const renderer = this._rendererInterfaces[rendererID];
src/backend/renderer.js
+2 -8
@@ -686,10 +686,7 @@ export function attach(
686 pendingOperationsQueue.push(ops);
687 } else {
688 // If we've already connected to the frontend, just pass the operations through.
689 - hook.emit('operations', {
690 - operations: ops,
691 - rendererID,
692 - });
689 + hook.emit('operations', ops);
690 }
691
692 pendingOperations.length = 0;
@@ -1155,10 +1152,7 @@ export function attach(
1152 // We may have already queued up some operations before the frontend connected
1153 // If so, let the frontend know about them.
1154 localPendingOperationsQueue.forEach(ops => {
1158 - hook.emit('operations', {
1159 - operations: ops,
1160 - rendererID,
1161 - });
1155 + hook.emit('operations', ops);
1156 });
1157 } else {
1158 // Before the traversals, remember to start tracking