Function group_entries
pub fn group_entries(
entries: &[HistoryEntry],
named: &[NamedRange],
cfg: &GroupingConfig,
) -> Vec<HistoryGroup>Expand description
Group entries (oldest first, in the producer’s causal order).
§Concurrent naming
Two people naming ranges at the same time resolves here, at read time, identically on every peer — the inputs are the document and nothing else.
- The same range, twice. Both writes land on the same document key (derived from the range’s first change), so automerge’s map-conflict rule picks one deterministically; the other stays recoverable in the change graph.
- One range inside another. The inner one becomes a child of the
outer, up to
MAX_GROUP_DEPTH. Deeper than that, it is not rendered as a group but reappears once an enclosing name is removed. - Ranges that partly overlap. The earlier-starting range keeps its whole span; the later one is clipped to what’s left — clipping rather than dropping means neither user loses their name to a race.
A named range whose first change is not in entries is skipped: the
surface cannot show a band whose contents it does not have.