Skip to content

Commit 503523a

Browse files
zxch3nclaude
andcommitted
docs: add important limitation section to Frontiers documentation
Added a clear explanation of Frontiers' key limitation: - When dealing with unknown operations, Frontiers cannot determine the complete set of included operation IDs - Extended the family tree analogy to illustrate this limitation - Contrasted with Version Vectors which explicitly list all operations - Added practical example showing the difference - Explained why this makes Frontiers best for local checkpoints and Version Vectors better for synchronization This helps users understand the trade-offs between the two version representation methods. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent b18cde7 commit 503523a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

pages/docs/concepts/frontiers.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Frontiers are ideal for:
5151
| **Size** | 1-2 elements typically | Grows with peer count |
5252
| **Use Case** | Checkpoints, time travel | Synchronization, diffing |
5353
| **Storage** | Very compact | Larger with many peers |
54+
| **Unknown ops** | Cannot determine included ops | Can determine all included ops |
5455

5556
## Practical Example
5657

@@ -75,6 +76,32 @@ doc.checkout(checkpoints.get("draft"));
7576
console.log(text.toString()); // "Draft version"
7677
```
7778

79+
## Important Limitation
80+
81+
Frontiers have a key limitation when dealing with unknown operations. Let's extend our family tree analogy:
82+
83+
**Scenario**: Imagine you only know the youngest generation (the frontier) of a family tree. If someone tells you "person X is an ancestor," but you don't have the full family tree, you cannot determine all family members included up to that youngest generation.
84+
85+
Similarly with Frontiers:
86+
- When you have a Frontier pointing to operations you don't know about, you cannot determine the complete set of operation IDs included in that version
87+
- Version Vectors don't have this limitation - they explicitly list all peers and their operation counts, so you always know exactly which operations are included
88+
89+
**Example**:
90+
```ts twoslash
91+
import { LoroDoc } from "loro-crdt";
92+
93+
// If you receive a frontier [{ peer: "unknown-peer", counter: 42 }]
94+
// Without having the operations from "unknown-peer":
95+
// - Frontiers: Cannot tell which specific operations are included
96+
// - Version Vector: Would show { "unknown-peer": 43 }, clearly indicating ops 0-42
97+
98+
const doc = new LoroDoc();
99+
const frontiers = doc.frontiers();
100+
// Frontiers are compact but require operation history for full information
101+
```
102+
103+
This limitation is why Frontiers are best for scenarios where you have access to the operation history (like checkpoints in a local document), while Version Vectors are preferred for synchronization between peers who may not share complete history.
104+
78105
## Conversion with Version Vectors
79106

80107
Loro allows seamless conversion between representations:

0 commit comments

Comments
 (0)