Example
Parameters
DetailPageOptions<T, C, U, EntityField, VarNameCreate, VarNameUpdate>Options used to configure the result of the useDetailPage hook.
stringThe page id. This is optional, but if provided, it will be used to identify the page when extending the detail page query
TThe query document to fetch the entity.
EntityFieldThe field of the query document that contains the entity.
{ id: string; }The parameters used to identify the entity.
stringThe entity type name for custom field configuration lookup. Required to filter out readonly custom fields before mutations. If not provided, the function will try to infer it from the query document.
CThe document to create the entity.
UThe document to update the entity.
( entity: NonNullable<ResultOf<T>[EntityField]>, ) => WithLooseCustomFields<VariablesOf<U>[VarNameUpdate]>The function to set the values for the update document.
(input: VariablesOf<C>[VarNameCreate]) => VariablesOf<C>[VarNameCreate](input: VariablesOf<U>[VarNameUpdate]) => VariablesOf<U>[VarNameUpdate](schema: ZodObject<any>) => ZodTypeAnyv3.7.0Refines the auto-generated Zod schema for this page's form. Use this to declare the fields the user must actually fill in.
The generated schema is derived from the GraphQL input type, which only expresses nullability — and nullability tells you nothing about whether a value is required:
String! means "not null",
not "not empty", and a non-nullable ID! such as CreateFacetValueInput.facetId
may be supplied by the page in transformCreateInput rather than by the user.CreateChannelInput. defaultCurrencyCode is nullable, yet ChannelService.create rejects the input
unless it is set.So required-ness is declared per page, here.
Example
(entity: ResultOf<C>[keyof ResultOf<C>] | ResultOf<U>[keyof ResultOf<U>]) => voidThe function to call when the update is successful.
(error: unknown) => voidThe function to call when the update is successful.
Architecture reviews, custom plugin work, migrations, ongoing support. Get a hand from the team that builds Vendure.
Talk to the team