-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(next): support document view conditions #12698
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
base: main
Are you sure you want to change the base?
Conversation
packages/next/src/elements/DocumentHeader/Tabs/getViewConfig.ts
Outdated
Show resolved
Hide resolved
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.
This is looking good—and now that I think about it, we can also deprecate the hideAPIURL
property at this point!
We used to render a link to the API endpoint directly on the edit view, but now that it's been given a dedicated page, view conditions should be used to control this instead. I don't think it makes a lot of sense to continue using this property.
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.
It just dawned on me that we might want to control default views on a different property. This will be more future proof, as these features may not use views forever. For example Live Preview is actively being mounted to the /:id route. Let's talk about this.
Introduces the ability to conditionally render document views. This way you can restrict access to entire views based on certain criteria, such as requesting user or data.
For example, you might want to limit access the
/:id/api
route to only certain roles.To do this, use the new
condition
property in your edit view's config: