Mutation since v0.2
Representation of a mutation of remote data.
Commands
This section describes the Event that can be used to perform actions on the Mutation. Commands should be called in application code.
start
Unconditionally starts the Mutation with the given parameters.
reset
since v0.12
Resets the Mutation to the initial state.
Stores
This section describes the Stores that can be used to read the Mutation state.
$status
Store with the current status of the Mutation. It must not be changed directly. Can be one of the following values: "initial"
, "pending"
, "done"
, "fail"
.
For convenience, there are also the following Stores:
$idle
since v0.8 —true
if the Mutation is in the"initial"
state,false
otherwise.$pending
—true
if the Mutation is in the"pending"
state,false
otherwise.$failed
—true
if the Mutation is in the"fail"
state,false
otherwise.$succeeded
—true
if the Mutation is in the"done"
state,false
otherwise.$finished
since v0.9 —true
if the Mutation is in the"done"
or"fail"
state,false
otherwise.
$enabled
Store with the current enabled state of the Mutation. Disabled Mutations will not be executed, instead, they will be treated as skipped. It must not be changed directly. Can be true
or false
.
Events
This section describes the Event that can be used to listen to the Mutation state changes. Events must not be called in application code.
finished.success
Event that will be triggered when the Mutation is finished with success. Payload will contain the object with the following fields:
params
with the parameters that were used to start the Mutationresult
with the result of the Mutationmeta
with the execution metadata
finished.failure
Event that will be triggered when the Mutation is finished with failure. Payload will contain the object with the following fields:
params
with the parameters that were used to start the Mutationerror
with the error of the Mutationmeta
with the execution metadata
finished.skip
Event that will be triggered when the Mutation is skipped. Payload will contain the object with the following fields:
params
with the parameters that were used to start the Mutationmeta
with the execution metadata
finished.finally
Event that will be triggered when the Mutation is finished with success, failure or skip. Payload will contain the object with the following fields:
params
with the parameters that were used to start the Mutationmeta
with the execution metadatastatus
since v0.9 with a string"done"
,"fail"
or"skip"
for success, failure or skip respectivelyresult
since v0.9 if thestatus
is"done"
with the result of the Mutationerror
since v0.9 if thestatus
is"fail"
with the error of the Mutation
aborted
since v0.10
Event that will be triggered when the Mutation is aborted. Payload will contain the object with the following fields:
params
with the parameters that were used to start the Querymeta
with the execution metadata
INFO
Aborted Mutation are not treated as failed since v0.10. This means that .finished.failure
will not be triggered in case of abortion.
started
since v0.9
Event that will be triggered when the Mutation is started. Payload will contain the object with the following fields:
params
with the parameters that were used to start the Mutationmeta
with the execution metadata