Skip to content

Commit 479bc11

Browse files
committed
Log alert when merging into an empty array
1 parent 98e4511 commit 479bc11

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/Onyx.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ function merge<TKey extends OnyxKey>(key: TKey, changes: OnyxMergeInput<TKey>):
236236
}
237237

238238
try {
239+
if (Array.isArray(existingValue) && existingValue.length === 0) {
240+
Logger.logAlert(`[ENSURE_BUGBOT] Onyx merge called on key "${key}" whose existing value is an empty array. Will coerce to object.`);
241+
}
242+
239243
const validChanges = mergeQueue[key].filter((change) => {
240244
const {isCompatible, existingValueType, newValueType} = utils.checkCompatibilityWithExistingValue(change, existingValue);
241245
if (!isCompatible) {

0 commit comments

Comments
 (0)