Catalog Crdt

<.provider>

ConnieUI.Crdt

Exempt from the catalog

joins the host's `/doc` Yjs channel as it mounts, and the playground runs no document server. The read-only editor it hosts is shown on a projection instead

Docs

Hosts a collaborative document on a page that has no form to submit. Same connection as `form/1` — the same Y.Doc, channel, local cache, `data-crdt-*` state and `crdt:ready` / `crdt:recovered` events — and the same `__crdt` context for child hooks, which find it by walking up from themselves rather than by looking for a `<form>`. What it does not do is bind form controls: no `YjsForm` is constructed, so nothing on the page can write a field value into the document. That is what makes it the right host for a read-only editor (`ConnieUI.CrdtEditor.crdt_editor/1` with `read_only`): the reader follows the live document and writes nothing to it. It also keeps no local copy by default, which `form/1` does. A cache is worth having for someone who edits, because their own unsent changes survive a refresh. For someone who only reads it is a divergence trap: the cached state is applied before the channel has said anything, and a reader's socket is read-only, so whatever the cache holds and the server does not is never reconciled. The server drops the update it is sent and the reader goes on looking at text nobody else can see. Syncing purely from the channel means a reader is either right or visibly disconnected.
Attribute Type Default Description
id * :string
topic * :string
Channel topic — also used as the IndexedDB key
token * :string
Auth token for the channel socket
cache :boolean false
keep a local copy of the document in IndexedDB. Off by default: a provider hosts a reader, whose socket cannot push a cached divergence back. Turn it on only for a host whose reader may also write
nonce :string nil
Opaque nonce — when it differs from the IndexedDB-cached value, the local cache is wiped before loading. Only consulted when `cache` is on
rest :global
Slot Slot attributes Description
inner_block *