-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add beforeOperation.[create|update|delete]
and afterOperation.[create|update|delete]
operation routing for list hooks
#8826
Conversation
| 'views' | ||
| '__ksTelemetryFieldTypeName' | ||
| 'extraOutputFields' | ||
| 'unreferencedConcreteInterfaceImplementations' |
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 will minimize the number of breaking changes moving forward and keeps us keenly aware of what else is being copied to this type.
@@ -20,7 +20,7 @@ export type FilterOrderArgs<ListTypeInfo extends BaseListTypeInfo> = { | |||
export type CommonFieldConfig<ListTypeInfo extends BaseListTypeInfo> = { | |||
access?: FieldAccessControl<ListTypeInfo>; | |||
hooks?: FieldHooks<ListTypeInfo, ListTypeInfo['fields']>; | |||
label?: string; | |||
label?: string; // TODO: move to ui? |
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.
Apparently text({ label: 'a text field' })
is what we use for fields, but not for lists.
Strange
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit da90b62:
|
what about |
@gautamsi edit: as you can see however, I am adding this functionally for fields internally, so we can make that a clean breaking change |
I think probably only one version should be allowed, |
Alternatively, I could add |
why not |
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.
Nice!
@gautamsi what do you do if users provide both? (as I mentioned in #8826 (comment)) validate: {
create: ...
update: ...
delete: ...
}
validateInput: ...
validateDelete: ... That is the question I don't know the answer to, and thus it seems like it might end up as a breaking change, unlike this pull request. |
I guess throw error and have them provide only one, this is breaking changes so they should be able to work through |
Can you do that in upcoming breaking change ? It will streamline |
@gautamsi that is my intent, yes - and I might add support earlier as you said, with a |
This pull request adds the
.[create|update|delete]
hooks for the*Operation
list hooks, and adds the same for field hooks internally (but not externally, as that is a breaking change for fields).This routing is preferred for the refined type guarantees it can offer your application without needing to branch the types yourself.