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
Feature/toplevel document type #293
Conversation
I think the surprising behaviour is acceptable. We will make it clear in the documentation wherever |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome as far as I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A substantial UX improvement on a small code footprint!
…hema has any defined document types
a02fc61
to
4fa9604
Compare
I've added a console-warning if there are I've also written a help page for this: https://sanity.io/help/toplevel-objects-to-document-type Good to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work! 👍
* [schema] Support type: document * [base] Change type of bundled types to document * [data-aspects] Make getInferredTypes only return document types if schema has any defined document types * [data-aspects] Warn if encountering both document types and a hiddentTypes config * [cli] Remove update movies-schema and remove hiddenTypes from moviesdb template * [misc] Remove references to hiddenTypes config
This supports
type: 'document'
which is in essence an alias for object types, but will be the only types that can be created as documents (with_id
), and will also be the only types listed in the side panel by default.This is backwards compatible, except for a little potential surprising side effect: if you now define a new document type in your schema without renaming the existing
object
types, all the existing object types will disappear from the sidebar by default. The solution is to change the type of the object types that you want to be documents fromobject
todocument
.I can't think of an easy way to fix this, but maybe its acceptable as long as we document how to fix it? What do you think?