Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions API-INTERNAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ provider) once so it&#39;s visible, then bounded retry without eviction.</li>
<dt><a href="#broadcastUpdate">broadcastUpdate()</a></dt>
<dd><p>Notifies subscribers and writes current value to cache</p>
</dd>
<dt><a href="#prepareKeyValuePairsForStorage">prepareKeyValuePairsForStorage()</a></dt>
<dt><a href="#prepareKeyValuePairsForStorage">prepareKeyValuePairsForStorage()</a></dt>
<dd><p>Storage expects array like: [[&quot;@MyApp_user&quot;, value_1], [&quot;@MyApp_key&quot;, value_2]]
This method transforms an object like {&#39;@MyApp_user&#39;: myUserValue, &#39;@MyApp_key&#39;: myKeyValue}
to an array of key-value pairs in the above format and removes key-value pairs that are being set to null</p>
to an array of key-value pairs in the above format, and collects the keys of null values into
<code>keysToRemove</code> for the caller to delete as one batch (cache drop + notification + batched storage removal).</p>
</dd>
<dt><a href="#mergeChanges">mergeChanges(changes, existingValue)</a></dt>
<dd><p>Merges an array of changes with an existing value or creates a single change.</p>
Expand Down Expand Up @@ -376,13 +377,13 @@ Notifies subscribers and writes current value to cache
**Kind**: global function
<a name="prepareKeyValuePairsForStorage"></a>

## prepareKeyValuePairsForStorage()
## prepareKeyValuePairsForStorage()
Storage expects array like: [["@MyApp_user", value_1], ["@MyApp_key", value_2]]
This method transforms an object like {'@MyApp_user': myUserValue, '@MyApp_key': myKeyValue}
to an array of key-value pairs in the above format and removes key-value pairs that are being set to null
to an array of key-value pairs in the above format, and collects the keys of null values into
`keysToRemove` for the caller to delete as one batch (cache drop + notification + batched storage removal).

**Kind**: global function
**Returns**: an array of key - value pairs <[key, value]>
<a name="mergeChanges"></a>

## mergeChanges(changes, existingValue)
Expand Down Expand Up @@ -524,7 +525,6 @@ that this internal function allows passing an additional `mergeReplaceNullPatche
| params.collectionKey | e.g. `ONYXKEYS.COLLECTION.REPORT` |
| params.collection | Object collection keyed by individual collection member keys and values |
| params.mergeReplaceNullPatches | Record where the key is a collection member key and the value is a list of tuples that we'll use to replace the nested objects of that collection member record with something else. |
| params.isProcessingCollectionUpdate | whether this is part of a collection update operation. |
| retryAttempt | retry attempt |

<a name="partialSetCollection"></a>
Expand Down
3 changes: 1 addition & 2 deletions lib/Onyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ function merge<TKey extends OnyxKey>(key: TKey, changes: OnyxMergeInput<TKey>):
* @param collection Object collection keyed by individual collection member keys and values
*/
function mergeCollection<TKey extends CollectionKeyBase>(collectionKey: TKey, collection: OnyxMergeCollectionInput<TKey>): Promise<void> {
return OnyxUtils.afterInit(() => OnyxUtils.mergeCollectionWithPatches({collectionKey, collection, isProcessingCollectionUpdate: true}));
return OnyxUtils.afterInit(() => OnyxUtils.mergeCollectionWithPatches({collectionKey, collection}));
}

/**
Expand Down Expand Up @@ -565,7 +565,6 @@ function update<TKey extends OnyxKey>(data: Array<OnyxUpdate<TKey>>): Promise<vo
collectionKey,
collection: batchedCollectionUpdates.merge as OnyxMergeCollectionInput<OnyxKey>,
mergeReplaceNullPatches: batchedCollectionUpdates.mergeReplaceNullPatches,
isProcessingCollectionUpdate: true,
}),
);
}
Expand Down
Loading
Loading