Skip to content

Commit

Permalink
fix equalDeleteSets
Browse files Browse the repository at this point in the history
  • Loading branch information
YousefED committed Jun 21, 2023
1 parent c398448 commit 12be6c0
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/utils/DeleteSet.js
@@ -1,18 +1,26 @@

import {
DSDecoderV1,
DSDecoderV2,
DSEncoderV1,
DSEncoderV2,
GC,
ID // eslint-disable-line
,
Item,
StructStore, Transaction,
UpdateEncoderV2,
findIndexSS,
getState,
splitItem,
iterateStructs,
UpdateEncoderV2,
DSDecoderV1, DSEncoderV1, DSDecoderV2, DSEncoderV2, Item, GC, StructStore, Transaction, ID // eslint-disable-line
splitItem
} from '../internals.js'

import * as array from 'lib0/array'
import * as math from 'lib0/math'
import * as map from 'lib0/map'
import * as encoding from 'lib0/encoding'
import * as decoding from 'lib0/decoding'
import * as encoding from 'lib0/encoding'
import * as map from 'lib0/map'
import * as math from 'lib0/math'

export class DeleteItem {
/**
Expand Down Expand Up @@ -335,7 +343,7 @@ export const readAndApplyDeleteSet = (decoder, transaction, store) => {
*/
export const equalDeleteSets = (ds1, ds2) => {
if (ds1.clients.size !== ds2.clients.size) return false
ds1.clients.forEach((deleteItems1, client) => {
for (const [client, deleteItems1] of ds1.clients.entries()) {
const deleteItems2 = /** @type {Array<import('../internals.js').DeleteItem>} */ (ds2.clients.get(client))
if (deleteItems2 === undefined || deleteItems1.length !== deleteItems2.length) return false
for (let i = 0; i < deleteItems1.length; i++) {
Expand All @@ -345,6 +353,6 @@ export const equalDeleteSets = (ds1, ds2) => {
return false
}
}
})
}
return true
}

0 comments on commit 12be6c0

Please sign in to comment.