Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix duplicates in crdt.Set #19

Merged
merged 1 commit into from Jan 23, 2013

Conversation

Projects
None yet
2 participants
Contributor

Raynos commented Jan 23, 2013

crdt.Set can have duplicate rows in it if you do

doc.add({ id: "foo", type: "in-set" })
doc.add({ id: "foo", type: "in-set" })

Both of those additions trigger the doc.sets.emit("type") event
thus getting the same row in a set twice.

This patch ensures the row isn't in the set before it's added.

@Raynos Raynos Fix duplicates in crdt.Set
`crdt.Set` can have duplicate rows in it if you do

```js
doc.add({ id: "foo", type: "in-set" })
doc.add({ id: "foo", type: "in-set" })
```

Both of those additions trigger the `doc.sets.emit("type")` event
thus getting the same row in a set twice.

This patch ensures the row isn't in the set before it's added.
d8bdb6b

@dominictarr dominictarr merged commit d8bdb6b into dominictarr:master Jan 23, 2013

Owner

dominictarr commented Jan 23, 2013

thanks, merged into 3.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment