Reference · React
useVersions(uri, options?)
React hooktechne-sdk/reactIn the SDK, techne.versions
A record as its versions, for a versions pill, a field-conflict badge and a versions sheet. It also holds which version the person picked.
useRecord and useRecordQuery never carry versions. This is the one read that does. The ranking comes from the same Rust the curator composes with, run as WebAssembly, so the screen and the curator cannot disagree.
Parameters
| Name | Type | What it is |
|---|---|---|
urirequired | string | null | undefined | The record's at:// address. A null or undefined URI reads nothing. |
options.enabled | boolean | false holds the read. |
options.subscribed | boolean | false keeps a hidden screen off the cache's updates. |
Returns TanStack's query result, plus
| Name | Type | What it is |
|---|---|---|
item | Item<T> | null | undefined | The composed record. Once a version is selected, that version's own values, with the same uri and verdict. null when nothing is there, undefined until read. |
versions | VersionEntry[] | Every version as the versions sheet lists them. Empty until read. |
conflicts | { [field]: number } | Each field whose ranked versions disagree, and how many values they give. |
selected | string | null | The selected version's URI, or null for the composition. |
select | (uri | null) => void | Show one version. null goes back to the composition. A URI that is not among the versions is ignored. |
byline | VersionEntry | null | The version that speaks first. The one selected, else the composition's byline. |
pill | { label, count, accessibilityLabel } | null | The version pill, e.g. “from Backstreet Museum calendar · 2 sources”. |
conflict | (field) => { count, accessibilityLabel } | null | The field-conflict badge for one field or several. null under 2. |
state | EventState | null | The state the versions views draw. null until read, and for a record answered privately. |
Each version
uri | string | The version's own address. |
did | string | Its author. |
name · handle | string | Who to show it as. |
group | 'sources' | 'verified' | 'others' | Where the sheet lists it. Sources are rank 1, verified accounts rank 2, everyone else rank 3. |
verified | boolean | A verification record by an issuer the root endorses is about its author. |
showing | boolean | It is the version being shown. |
differs · same | string[] | The fields where it says something other than what is shown, and where it agrees. |
record | object | Its values. |
Its key is ['techne', 'versions', uri, did]. A selection resets when the URI changes, and a refetch that drops the selected version clears it.
A name with its conflict badge and version pill
The same read as a call
useVersions(uri) is useQuery(techne.versionsOptions(uri)), with the selection kept in the hook. techne.versions
Calls commons.getVersions, or query.getRecords → for a record answered privately