Search for data returning only entries from current session

I’m working on a chat functionality based on this article Messaging App - Bubble Docs The problematic part is doing a search for chat messages, where the chat channel is the same as parent group’s chat channel.

When I launch it in preview, write some messages, go into another channel, write some more messages, and go back it all works fine.

When I close the preview and launch it again, the database query returns nothing. Then if i create some new messages only they are returned. Historical data never comes from the DB, I verified it in the debugger.

Is there some setting I’m unaware of or is this a bug?

Make a Loom video and post it here, mate.
Its much easier to understand your problem and try to help you.

@Viktor Below is the behavior I see.

And here are some relevant code parts:

Let me know if you need more info.

Sounds like a privacy rules issue.

@adamhholmes But how is it possible I see them before reloading? Below are the rules for those two tables:

Because your privacy rules allow the current User to view messages for which they are a participant.

Exactly - I am the participant, so why can’t I load those messages anymore after reloading the page?

Well, presumably you’re no longer the same user.

But without knowing anything about your app and how it works (or how you’re testing it) no one can say for sure.

In any case, just check the debugger… it will tell you exactly what’s going on.

1 Like

As I said in the OP, I did check the debugger. I temporarily added some workflow steps to do these operations:

And the debugger confirms that current user is a participant in that chat channel, while the returned message list is empty for old messages. Once i start adding messages they would appear here: