Skip to content

Commit e2eb3bb

Browse files
authored
feat: support perspectives (#63)
1 parent e59e599 commit e2eb3bb

File tree

7 files changed

+14007
-32255
lines changed

7 files changed

+14007
-32255
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ import DocumentsPane from 'sanity-plugin-documents-pane'
3232
S.view
3333
.component(DocumentsPane)
3434
.options({
35-
query: `*[!(_id in path("drafts.**")) && references($id)]`,
35+
query: `*[references($id)]`,
3636
params: {id: `_id`},
37+
options: {perspective: 'previewDrafts'}
3738
})
3839
.title('Incoming References')
3940
```
@@ -47,6 +48,7 @@ The `.options()` configuration works as follows:
4748
- `useDraft` (bool, optional, default: `false`) When populating the `params` values, it will use the `published` version of the document by default. Not permitted if using a function for `params` as the function will determine which version of the document to use.
4849
- `debug` (bool, optional, default: `false`) In case of an error or the query returning no documents, setting to `true` will display the query and params that were used.
4950
- `initialValueTemplates` (function, optional) A function that receives the various displayed, draft, and published versions of the document, and returns a list of initial value templates. These will be used to define buttons at the top of the list so users can create new related documents.
51+
- `options` (object, optional) An object of options passed to the listening query. Includes support for `apiVersion` and `perspective`.
5052

5153
## Resolving query parameters with a function and providing initial value templates
5254

0 commit comments

Comments
 (0)