dominictarr / crdt

Commutative Replicated Data Types for easy collaborative/distributed systems.
MIT License
836 stars 43 forks source link

Fix duplicates in crdt.Set #19

Closed Raynos closed 11 years ago

Raynos commented 11 years ago

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.

dominictarr commented 11 years ago

thanks, merged into 3.4.2