| 247 | * Accepts mutations from a transaction that belong to this collection and persists them |
| 248 | */ |
| 249 | const acceptMutations = (transaction: { |
| 250 | mutations: Array<PendingMutation<Record<string, unknown>>> |
| 251 | }) => { |
| 252 | // Filter mutations that belong to this collection |
| 253 | const collectionMutations = transaction.mutations.filter( |
| 254 | (m) => m.collection.id === collectionId, |
| 255 | ) |
| 256 | |
| 257 | if (collectionMutations.length === 0) { |
| 258 | return |
| 259 | } |
| 260 | |
| 261 | // Persist the mutations through sync |
| 262 | syncResult.confirmOperationsSync( |
| 263 | collectionMutations as Array<PendingMutation<T>>, |
| 264 | ) |
| 265 | } |
| 266 | |
| 267 | return { |
| 268 | ...restConfig, |