Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tgolen opened this issue Dec 14, 2022 · 0 comments · Fixed by Expensify/react-native-onyx#216
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review

Comments

@tgolen
Copy link
Contributor

tgolen commented Dec 14, 2022

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

@tgolen tgolen added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 14, 2022
@tgolen tgolen self-assigned this Dec 14, 2022
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Dec 14, 2022
@tgolen tgolen added Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review labels Dec 14, 2022
@Expensify Expensify unlocked this conversation Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review
Projects
None yet
2 participants