right now, when we, say, need to get all the opponent players that a given user has matches with, for every opponent player's id, we send an individual firebase request.
while i don't have the performance analytics or anything, it doesn't feel great firing off n requests, where n is equal to how ever many opponents a given user has. if a user has been playing a shit ton of games with a lot of different people, that could mean firing, say, 100 unique requests every time we load the /lobby. that seems absurd.
solutions
firestore comes with the ability to make queries. i believe these can be leveraged to make more efficient (and, if this thing gets popular, cheaper [both computationally and monetarily]) requests.
light reading
an example of using firestore queries (and react-query) to simplify requests
the problem
id
, we send an individual firebase request.n
requests, wheren
is equal to how ever many opponents a given user has. if a user has been playing a shit ton of games with a lot of different people, that could mean firing, say,100
unique requests every time we load the/lobby
. that seems absurd.solutions
light reading
react-query
) to simplify requests