Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
We recently updated
Onyx.clear
such that it actually removes items we don't want to keep from storage, rather than just setting them to null.However, we did not update
Onyx.clear()
to update the cache accordingly – it still just sets items tonull
. I think this is expected for any existing Onyx subscribers – the value should go from being whatever it was before tonull
. However, any new call toOnyx.connect
should not have any record of cleared keys.cc @tienifr
Related Issues
https://github.com/Expensify/Expensify/issues/277227 – related to tests
Automated Tests
I was testing this in Expensify/App#17718 – there are currently some
TODOs
above code that filters out null items from Onyx because they're making it harder to make assertions about things like the number of reports in Onyx.After updating Onyx to use the latest version which includes the new version of
Onyx.clear
and removing the filters, I found that the test was still failing and showed reports that should have been cleared asnull
in Onyx. After debugging, I discovered that the problem was that the cache was not being updated correctly.I also updated the tests in this repo accordingly, and I think that the new behavior is correct.
Linked PRs
Expensify/App#17718