issue: ENG-7743
We can now fetch the usernames using the identity RPC
Details
- Reviewers
tomek kamil - Commits
- rCOMMbc2f5fa1adcf: [lib] Fetch missing usernames
tested that when new user infos without usernames are added to the store, the effect is run and the usernames are fetched from identity, and inserted into user infos in the user store.
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
This solution has one issue: we always send requests for all the users even if we've just asked for some of them. The following scenario shows the issue:
- New unknown users appear in the store with IDs e.g. [1,2,3]
- We send a request to identity asking about [1,2,3]
- A new unknown user 4 appears
- We send a request to identity asking about [1,2,3,4]
- Identity responds with [1,2,3]
- Identity responds with [1,2,3,4]
This is a slight performance issue, so it's probably not worth spending too much time on it, but it can be fixed by maintaining a set of users for which a request to identity is pending and only send a request for the users without pending requests.
lib/handlers/user-infos-handler.react.js | ||
---|---|---|
35–53 ↗ | (On Diff #40673) | This isn't accurate, because on line 35 we're creating a function instead of a promise |
Address review
I created a scenario as descibed by @tomek, by dispatching two processNewUserIDsActionType actions and adding a sleep in findUserIdentities to make sure the second action is parsed before the id from the first action gets its username in redux.
Then I added this code and checked that the problem is fixed