Skip to content

Calling Onyx.clear() does not send the right data to collection callbacks using waitForCollectionCallback #13584

Description

@tgolen

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2InternalRequires API changes or must be handled by Expensify staffReviewingHas a PR in review

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions