react-native-onyx icon indicating copy to clipboard operation
react-native-onyx copied to clipboard

Update the `multiSet` to update subscribers in a more optimized way

Open yuwenmemon opened this issue 2 years ago • 0 comments

Problem

Currently, the way multiset works is that it notifies subscribers of any changes to the onyx keys in a loop:

https://github.com/Expensify/react-native-onyx/blob/f96fa2dc38b6abd1f99512af59647162fa11c88e/lib/Onyx.js#L985-L992

The performance of this can be improved in relation to collections, where we can see if all the keys are part of a collection, and if so - use keysChanged to update subscribers in a more optimized way.

Solution

Either:

  1. Update multiset to support the above, or
  2. Create a setCollection that is optimized for collections

cc @marcaaron

yuwenmemon avatar Aug 23 '23 03:08 yuwenmemon