Read renderer ID from operations

This commit is contained in:
Dan Abramov
2019-04-24 15:00:46 +01:00
parent 26162988aa
commit e050529c7d
2 changed files with 4 additions and 14 deletions
+2 -6
View File
@@ -29,11 +29,6 @@ const debug = (methodName, ...args) => {
}
};
type OperationsParams = {|
operations: Uint32Array,
rendererID: number,
|};
type InspectSelectParams = {|
id: number,
rendererID: number,
@@ -505,7 +500,7 @@ export default class Agent extends EventEmitter {
}
};
onHookOperations = ({ operations, rendererID }: OperationsParams) => {
onHookOperations = (operations: Uint32Array) => {
if (__DEBUG__) {
debug('onHookOperations', operations);
}
@@ -533,6 +528,7 @@ export default class Agent extends EventEmitter {
this._bridge.send('operations', operations);
if (this._persistedSelection !== null) {
const rendererID = operations[0];
if (this._persistedSelection.rendererID === rendererID) {
// Check if we can select a deeper match for the persisted selection.
const renderer = this._rendererInterfaces[rendererID];
+2 -8
View File
@@ -686,10 +686,7 @@ export function attach(
pendingOperationsQueue.push(ops);
} else {
// If we've already connected to the frontend, just pass the operations through.
hook.emit('operations', {
operations: ops,
rendererID,
});
hook.emit('operations', ops);
}
pendingOperations.length = 0;
@@ -1155,10 +1152,7 @@ export function attach(
// We may have already queued up some operations before the frontend connected
// If so, let the frontend know about them.
localPendingOperationsQueue.forEach(ops => {
hook.emit('operations', {
operations: ops,
rendererID,
});
hook.emit('operations', ops);
});
} else {
// Before the traversals, remember to start tracking