-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Improve Ion.connect() only calls setState() once for each react component #467
Comments
@marcaaron Your original comment around this code was:
After inspecting the code this morning, I don't think this is accurate about what the code does. This code here: https://github.com/Expensify/ReactNativeChat/blob/master/src/lib/Ion.js#L142-L147 will only call |
Throwing an error for now is a great idea! I'll try to add some context here since I'm not sure my point was understood and I think this is an opportunity to maybe simplify how this stuff works - but it's not particularly urgent.
So, nothing is broken yet. But I wonder if we can make this more predictable somehow. My first instinct is to say that regex keys are really cool, but we might not need them at all. The main use case seems to be for when we have a "collection". So we could maybe double down on the construct of a "collection" and make it more easily identifiable (vs. something that we put together in our heads when we see the combination of My proposal to improve this would be to remove all the cases where we have regex keys and instead be very specific about what we want to connect to... it's either going to be a single record ( Anyway, that's my idea. Maybe there are other use cases for the regex keys that I'm missing the context for (e.g. maybe we will have two completely different data types that we'll want to merge into a single collection that will be indexed by a property name). |
Spoke 1:1 with Marc about this to throw out some other ideas. We landed on this being a great premise to start with:
In this universe, that would essentially treat every subscription like it's a collection, and there could be collections with single keys, or collections with multiple keys, but everything is a collection. |
I'm going to close this because this has mostly been refactored for now. |
Referencing this cleanup task here: https://github.com/Expensify/ReactNativeChat/pull/426/files/aa194ecb6525a59748b57eccdaa16d0469ee4d26#diff-7cc9012ec34096901d5dc459cf9bd6c7R138
The text was updated successfully, but these errors were encountered: