[lib] Add memoization to useKeyserverCall
Summary:
issue: https://linear.app/comm/issue/ENG-4889/memoize-action-for-every-keyservercall
Fistly, boundCallServerEndpointSelector is added to memoize the value retuned from bindCookieAndUtilsIntoCallServerEndpoint based on its arguments. bindCookieAndUtilsIntoCallServerEndpoint creates some functions, so it might be beneficial to memoize them. It is also called when the action is being executed - only once the client decides which keyserver they want to call with this action, we can bind the correct cookie and other values to a callServerEndpoint. And we want actions to be as fast as possible.
Secondly, baseCreateBoundKeyserverCallActionSelector/createBoundKeyserverCallActionSelector is added. This is similar to baseCreateBoundServerCallsSelector that was used in useServerCall. _memoize keeps a map of results, keyed by the first argument of the function it memoizes. So what we are doing is creating a selector for each keyserverCall. Every one of those selectors remembers the last value calculated for its action.
Test Plan: Used searchMessagesActionObj described in the previous diff. Checked that searching messages using useKeyserverCall(searchMessagesActionObj); still works.
Reviewers: michal, kamil, ginsu
Reviewed By: michal
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D9143