Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support perspectives #63

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ import DocumentsPane from 'sanity-plugin-documents-pane'
S.view
.component(DocumentsPane)
.options({
query: `*[!(_id in path("drafts.**")) && references($id)]`,
query: `*[references($id)]`,
params: {id: `_id`},
options: {perspective: 'previewDrafts'}
})
.title('Incoming References')
```
Expand All @@ -47,6 +48,7 @@ The `.options()` configuration works as follows:
- `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.
- `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.
- `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.
- `options` (object, optional) An object of options passed to the listening query. Includes support for `apiVersion` and `perspective`.

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

Expand Down
Loading