Releases: loro-dev/loro
loro-wasm@0.15.1
Patch Changes
-
04c6290: Bug fixes and improvements.
🐛 Bug Fixes
- Impl a few unimplemented! for movable tree (#335)
- Refine ts type; reject invalid operations (#334)
- Get cursor err on text and movable list (#337)
- Missing MovableList in all container type (#343)
- Upgrade generic-btree to allow large btree (#344)
📚 Documentation
- Add warn(missing_docs) to loro and loro-wasm (#339)
- Minor fix on set_change_merge_interval api (#341)
⚙️ Miscellaneous Tasks
- Skip the checking if not debug_assertions (#340)
loro-crdt@0.15.1
Patch Changes
-
04c6290: Bug fixes and improvements.
🐛 Bug Fixes
- Impl a few unimplemented! for movable tree (#335)
- Refine ts type; reject invalid operations (#334)
- Get cursor err on text and movable list (#337)
- Missing MovableList in all container type (#343)
- Upgrade generic-btree to allow large btree (#344)
📚 Documentation
- Add warn(missing_docs) to loro and loro-wasm (#339)
- Minor fix on set_change_merge_interval api (#341)
⚙️ Miscellaneous Tasks
- Skip the checking if not debug_assertions (#340)
-
Updated dependencies [04c6290]
- loro-wasm@0.15.1
loro-wasm@0.15.0
Minor Changes
-
Loro's List supports insert and delete operations but lacks built-in methods for
set
andmove
. To simulate set and move, developers might combine delete and insert. However, this approach can lead to issues during concurrent operations on the same element, often resulting in duplicate entries upon merging.For instance, consider a list [0, 1, 2]. If user A moves the element '0' to position 1, while user B moves it to position 2, the ideal merged outcome should be either [1, 0, 2] or [1, 2, 0]. However, using the delete-insert method to simulate a move results in [1, 0, 2, 0], as both users delete '0' from its original position and insert it independently at new positions.
To address this, we introduce a MovableList container. This new container type directly supports move and set operations, aligning more closely with user expectations and preventing the issues associated with simulated moves.
Example
import { Loro } from "loro-crdt"; import { expect } from "vitest"; const doc = new Loro(); const list = doc.getMovableList("list"); list.push("a"); list.push("b"); list.push("c"); expect(list.toArray()).toEqual(["a", "b", "c"]); list.set(2, "d"); list.move(0, 1); const doc2 = new Loro(); const list2 = doc2.getMovableList("list"); expect(list2.length).toBe(0); doc2.import(doc.exportFrom()); expect(list2.length).toBe(3); expect(list2.get(0)).toBe("b"); expect(list2.get(1)).toBe("a"); expect(list2.get(2)).toBe("d");
loro-crdt@0.15.0
Minor Changes
-
Loro's List supports insert and delete operations but lacks built-in methods for
set
andmove
. To simulate set and move, developers might combine delete and insert. However, this approach can lead to issues during concurrent operations on the same element, often resulting in duplicate entries upon merging.For instance, consider a list [0, 1, 2]. If user A moves the element '0' to position 1, while user B moves it to position 2, the ideal merged outcome should be either [1, 0, 2] or [1, 2, 0]. However, using the delete-insert method to simulate a move results in [1, 0, 2, 0], as both users delete '0' from its original position and insert it independently at new positions.
To address this, we introduce a MovableList container. This new container type directly supports move and set operations, aligning more closely with user expectations and preventing the issues associated with simulated moves.
Example
import { Loro } from "loro-crdt"; import { expect } from "vitest"; const doc = new Loro(); const list = doc.getMovableList("list"); list.push("a"); list.push("b"); list.push("c"); expect(list.toArray()).toEqual(["a", "b", "c"]); list.set(2, "d"); list.move(0, 1); const doc2 = new Loro(); const list2 = doc2.getMovableList("list"); expect(list2.length).toBe(0); doc2.import(doc.exportFrom()); expect(list2.length).toBe(3); expect(list2.get(0)).toBe("b"); expect(list2.get(1)).toBe("a"); expect(list2.get(2)).toBe("d");
Patch Changes
- Updated dependencies [35b9b6e]
- loro-wasm@0.15.0