EditPage
The EditPage
component is responsible for handling the submission, loading, and error handling logic associated with editing a node.
Properties
editQuery
- required - The query called whenever creating the resource. It is passed an$input
variable.additionalRefetchQueries
- An array of additional queries to refetch.idPath
- required - The path in thecreateQuery
to the resulting created nodeid
idOverride
- If you want to manually specify the ID instead of having it pulled from the URL, do that here.onEditCompleted
- Called whenever the edit is completed.onEditCompleted(mutationData) -> Boolean
If this returns false, the user will not be redirected to the
View
page for the node.
beforeSubmit
- Callback allowing you to modify the payload before it is sent to the query.beforeSubmit(payload) -> Object
isModal
- Whether or not to render inside a modal instead of as its own page.onModalClosed
- Callback whenever the modal needs to be closed (if rendering as a modal)visible
- IfisModal
is true, whether or not the modal is visible.See below for an example of what payload looks like.
Payload Object
getFieldDecorator
modifications
getFieldDecorator
modificationsYou'll notice in the example at the bottom of this screen that we are not providing the initialValue
field to getFieldDecorator
. This is because if the field is simple, the EditPage
component will provide it automatically.
If the field is more complicated (for example, you might be pulling a name from a nested entity, like editing a category name on a version), you can always override initialValue
yourself, just as you normally would, using the node
variable provided inside the render function.
Example
Last updated