Problem
Since Expensify/react-native-onyx#214 was written, when Onyx.clear() is called, and a collection callback is using waitForCollectionCallback is being called n times with each item in the collection passed to it. This is bad because when an Onyx connection is using waitForCollectionCallback, the callback always expects to be called once with a single object for the entire collection.
This results in unexpected behavior for these callbacks when Onyx is cleared.
Solution
Update Onyx.clear() to properly handle this case and only trigger the callback once with the entire collection.
cc @yuwenmemon
Problem
Since Expensify/react-native-onyx#214 was written, when
Onyx.clear()is called, and a collection callback is usingwaitForCollectionCallbackis being calledntimes with each item in the collection passed to it. This is bad because when an Onyx connection is usingwaitForCollectionCallback, the callback always expects to be called once with a single object for the entire collection.This results in unexpected behavior for these callbacks when Onyx is cleared.
Solution
Update
Onyx.clear()to properly handle this case and only trigger the callback once with the entire collection.cc @yuwenmemon