Skip to content

Collaborative form

Two replicas of one form, there to make a single decision visible: which field type you pick determines what happens when two people edit the same thing at once - one value wins for a map entry, both edits survive in a nested text.

Two replicas of one form

Three map entries and one nested text. Edit a field in either replica and watch the other follow.

Opening two replicas…

The thing worth trying. Take Replica B offline. In A, set the title to one thing and add a sentence to the notes. In B, set the title to something else and add a different sentence to the notes. Bring B back online. One of the two titles wins outright and the other is lost - while both sentences appear in the notes. Same two clients, same moment, same conflict; different outcome purely because of how the field was modelled.

Map entries and a nested text

Most collaborative features are not documents. They are forms, settings panels and entity editors whose shape is already a C# type. This page is two replicas of one such form, and it exists to make a single decision visible: which field type you pick determines what happens when two people edit the same thing at once.

The three fields at the top are plain map entries. Different fields never conflict - one person can change the title while another changes the owner and both survive, which is already better than the usual save-the-whole-record approach. But two people editing the same map field concurrently resolve last-writer-wins: one value survives, deterministically but arbitrarily, and the other is gone.

The notes field at the bottom is a nested BcrdtText instead. Concurrent edits to it merge character by character, exactly as on the text page.

form.EnsureText("notes").Insert(0, "...");   // a nested text: both edits merge
form.Set("title", "...");                    // a map entry: one side wins
An unhandled error has occurred. Reload 🗙