How do I get a RG to refresh based on a time-based search?

In my app users interact with each other and I want new notifications to show up in real time in a repeating group in the corner of the page for ~5 seconds, and then disappear. Using the data source below, they do show up when created, but they don’t fade away after 5 seconds even though they don’t meet the search condition. Is there anything I’m doing wrong here, or should this update?

I accomplished this by creating a “Do every 5 seconds” workflow where I use “Display List” and user the same search as above to set the RG list.

Why not just display an Alert element, which can fade out after a given measure of time?

Instead of what part of this? I would still need to know when to show the alert, which would still require me to do the search every 5 seconds, no?

If the source for your repeating group is a properly specified Search, there’s a basically magical connection to the database. When the result you’re searching for changes, the result will, well, change. And you can detect that. No need to poll.

List Shifter makes this easier as an explicit event will be thrown.

In vanilla Bubble you can do the following:

The source for my repeating group is defined there in the screenshot. New Notifications are popping in when they meet that criteria, the issue is that they’re staying there even after enough time has elapsed that they don’t meet the criteria anymore, after 5 seconds. I believe that’s because there’s no change to the database, it’s just time elapsing, so no refresh happens in the RG.

An Alert wouldn’t solve this because even though the Alert itself would fade, when it popped up again (because another new Notification was created to trigger that) it would have the old Notifications in it as well. That’s why I have to do something like manually redo the list every 5 seconds.

I could also add a field to the Notification that defaults to Yes and have the RG filter on that instead of time, and then have a scheduled workflow that runs 5 seconds after each Notification is created to change that field to no. That way the DB is being updated and I wouldn’t need to run a workflow every five seconds on the front end. However, I don’t want to do that as it would create a ton of workflows, but maybe that’s better than a bunch of DB calls on the front end?

TLDR: There is no piece of data changing for when I want to remove the Notification from the RG, it’s just time elapsing, so I need a time-based reset rather than a DB-based one.

This topic was automatically closed after 70 days. New replies are no longer allowed.