* Dehydrates a single `Mutation` into a serializable snapshot of its key, state, scope, and meta. * @param mutation - The mutation to dehydrate. * @returns The dehydrated mutation.
(mutation: Mutation)
| 118 | * @returns The dehydrated mutation. |
| 119 | */ |
| 120 | function dehydrateMutation(mutation: Mutation): DehydratedMutation { |
| 121 | return { |
| 122 | mutationKey: mutation.options.mutationKey, |
| 123 | state: mutation.state, |
| 124 | ...(mutation.options.scope && { scope: mutation.options.scope }), |
| 125 | ...(mutation.meta && { meta: mutation.meta }), |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Prepares the in-flight promise of a pending query for dehydration: applies `serializeData` to its |