@fluidframework/map 2.0.0-internal.7.1.0 → 2.0.0-internal.7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/directory.js CHANGED
@@ -1278,9 +1278,12 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
1278
1278
  const pendingMessageIds = this.pendingKeys.get(op.key);
1279
1279
  // Only submit the op, if we have record for it, otherwise it is possible that the older instance
1280
1280
  // is already deleted, in which case we don't need to submit the op.
1281
- if (pendingMessageIds !== undefined &&
1282
- pendingMessageIds[0] === localOpMetadata.pendingMessageId) {
1283
- pendingMessageIds.shift();
1281
+ if (pendingMessageIds !== undefined) {
1282
+ const index = pendingMessageIds.findIndex((id) => id === localOpMetadata.pendingMessageId);
1283
+ if (index === -1) {
1284
+ return;
1285
+ }
1286
+ pendingMessageIds.splice(index, 1);
1284
1287
  if (pendingMessageIds.length === 0) {
1285
1288
  this.pendingKeys.delete(op.key);
1286
1289
  }
@@ -1522,17 +1525,15 @@ class SubDirectory extends client_utils_1.TypedEventEmitter {
1522
1525
  // If I have a NACK clear, we can ignore all ops.
1523
1526
  return false;
1524
1527
  }
1525
- const pendingKeyMessageId = this.pendingKeys.get(op.key);
1526
- if (pendingKeyMessageId !== undefined) {
1528
+ const pendingKeyMessageIds = this.pendingKeys.get(op.key);
1529
+ if (pendingKeyMessageIds !== undefined) {
1527
1530
  // Found an NACK op, clear it from the directory if the latest sequence number in the directory
1528
1531
  // match the message's and don't process the op.
1529
1532
  if (local) {
1530
1533
  (0, core_utils_1.assert)(localOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata), 0x011 /* pendingMessageId is missing from the local client's operation */);
1531
- const pendingMessageIds = this.pendingKeys.get(op.key);
1532
- (0, core_utils_1.assert)(pendingMessageIds !== undefined &&
1533
- pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x331 /* Unexpected pending message received */);
1534
- pendingMessageIds.shift();
1535
- if (pendingMessageIds.length === 0) {
1534
+ (0, core_utils_1.assert)(pendingKeyMessageIds[0] === localOpMetadata.pendingMessageId, 0x331 /* Unexpected pending message received */);
1535
+ pendingKeyMessageIds.shift();
1536
+ if (pendingKeyMessageIds.length === 0) {
1536
1537
  this.pendingKeys.delete(op.key);
1537
1538
  }
1538
1539
  }