UseDetailPage
Status: Developer Preview
This hook is used to create an entity detail page which can read and update an entity.
Example
Parameters
options
DetailPageOptions<T, C, U, EntityField, VarNameCreate, VarNameUpdate>Options used to configure the result of the useDetailPage hook.
pageId
stringThe page id. This is optional, but if provided, it will be used to identify the page when extending the detail page query
queryDocument
TThe query document to fetch the entity.
entityField
EntityFieldThe field of the query document that contains the entity.
params
{ id: string; }The parameters used to identify the entity.
entityName
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.
createDocument
CThe document to create the entity.
updateDocument
UThe document to update the entity.
setValuesForUpdate
( entity: NonNullable<ResultOf<T>[EntityField]>, ) => WithLooseCustomFields<VariablesOf<U>[VarNameUpdate]>The function to set the values for the update document.
transformCreateInput
(input: VariablesOf<C>[VarNameCreate]) => VariablesOf<C>[VarNameCreate]transformUpdateInput
(input: VariablesOf<U>[VarNameUpdate]) => VariablesOf<U>[VarNameUpdate]onSuccess
(entity: ResultOf<C>[keyof ResultOf<C>] | ResultOf<U>[keyof ResultOf<U>]) => voidThe function to call when the update is successful.
onError
(error: unknown) => voidThe function to call when the update is successful.