Reference · SDK
queryOptions · getOptions · versionsOptions
methodstechne-sdk/connectTanStack Query
The three reads in the form TanStack Query takes, a { queryKey, queryFn } each. Use them with TanStack Query outside the hooks, or with another data library.
The React hooks are these forms passed to useQuery. Each key starts ['techne', …] and ends with the viewer's DID, so one viewer's reads are never another's. A prefix such as ['techne', 'versions'] still names them all.
The three on techne
| Name | Type | What it is |
|---|---|---|
queryOptions(q, opts?) | { queryKey, queryFn } | Key ['techne', 'query', q, opts, did]. Its queryFn answers the Page of techne.query. |
getOptions(uri, opts?) | { queryKey, queryFn } | Key ['techne', 'record', uri, opts, did]. Its queryFn answers the item of techne.get, or null. |
versionsOptions(uri) | { queryKey, queryFn } | Key ['techne', 'versions', uri, did]. Its queryFn answers techne.versions. |
Options left out are {} in the key. The anonymous client's DID is empty, so its keys never meet a signed-in viewer's.
Each form ReadOptions
| Name | Type | What it is |
|---|---|---|
queryKey | readonly array | The cache key, as above. |
queryFn | () => Promise | Runs the read. |
Your own useQuery, and a refresh after a write
Prefetch on a server or before a screen opens
The hooks over them are useRecordQuery, useRecord and useVersions →