[lib] Introduce useDerivedObject for caching whole object when no values change
Summary:
We only need a subset of a KeyserverInfoPartial for constructing a keyserver call. Let's call that subset KeyserverCallInfo.
We can introduce a selector that will cache a KeyserverCallInfo for a given KeyserverInfoPartial. But we still have a problem, because we still need a way to make sure the whole object of KeyserverCallInfos doesn't change if a single KeyserverCallInfo changes.
This useDerivedObject does that. However, we still have an issue owing to the fact that the useDerivedObject will cache on a per-hook-invocation level, whereas bindCallKeyserverEndpointSelector is caching globally. The following diff will resolve that.
Depends on D10464
Test Plan:
Before this stack, I was able to reproduce ENG-3612 by going to the ThreadSettings screen in native while my local keyserver was down. After this stack, the issue no longer repros.
I also compiled a release build of the iOS app to my phone to confirm that there were no regressions in TTI, or the time it takes to open a MessageList and go back to the ChatThreadList.
Reviewers: inka, rohan
Reviewed By: inka
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D10465