punnP
Convex Community3y ago
2 replies
punn

Query behavior for same parameters

I'm noticing interesting behavior for a specific query in my app for different users.

The query fetches a list of messages for a given user by conversation ID. e.g. fetchMessagesByConvoId(convoId: number)

The messages table is indexed by conversationId.

Within the query, I use the
auth
object to fetch the user that called the query and use userId to filter messages by calling something like query(messages).indexby(convoId).filter(ownerUserId == userId).

Then I return this list to my webapp. However, in the case that two different users fetch messages by the same convoId, only the last user to call the query is returned the list of messages (the other user's list of messages becomes empty).

While this is a rare edge case for our app, I'm trying to understand why this happens. Do I need to disambiguate the queries by providing a different additional parameter for each user?
Was this page helpful?