writeOptimisticUpdates

abstract suspend fun <D : Operation.Data> writeOptimisticUpdates(operation: Operation<D>, data: D, mutationId: Uuid, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, publish: Boolean = false): Set<String>

Writes an operation to the optimistic store.

Optimistic updates must be enabled to use this method. To do so, pass enableOptimisticUpdates = true to the CacheManager constructor or normalizedCache extension.

Pass publish = true or call CacheManager.publish with the returned keys to notify any watchers.

Return

the changed field keys

Parameters

operation

the operation to write

data

the operation data to write

mutationId

a unique identifier for this optimistic update

publish

whether to notify watchers of the changes

See also


abstract suspend fun <D : Fragment.Data> writeOptimisticUpdates(fragment: Fragment<D>, cacheKey: CacheKey, data: D, mutationId: Uuid, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, publish: Boolean = false): Set<String>

Writes a fragment to the optimistic store.

Optimistic updates must be enabled to use this method. To do so, pass enableOptimisticUpdates = true to the CacheManager constructor or normalizedCache extension.

Pass publish = true or call CacheManager.publish with the returned keys to notify any watchers.

Return

the changed field keys

Parameters

fragment

the fragment to write

cacheKey

the root where to write the fragment data to

data

the fragment data to write

mutationId

a unique identifier for this optimistic update

publish

whether to notify watchers of the changes

See also