How to show "you've already read this" state?

To all,

I’m attempting to implement a “New*” type flag on cards that the user hasn’t seen yet. My thought is to keep a list on each card of the users who have viewed it and use that to control the visibility of the flag. When you open the card, I add you to the list, etc.

Is there a more efficient way to do this? Has anyone done this and have some words of wisdom to share?

Thanks!
–Treb

Hey @treb.gatte

My gut would go with the list as well. However, when lists get long, it can take Bubble quite a bit of time to filter through. So if you expect the list to get pretty long, you can search with some constraints which are processed surprisingly fast in Bubble.

@cmarchan may have some input

1 Like

Yup, what @mac2 said. I would consider a list of users on a card or a list of viewed cards on a user, and if one of those lists is likely to stay around or under 100 items, I would probably go that route. If both of those lists could get pretty large over time, then you should probably consider creating a thing in a custom data type every time a user views a card. As Mac said, searches through a data type with the proper constraints can be just as (if not more) efficient than a list of items stored on a thing.

Best…
Mike

1 Like

Hi @mac2 and @mikeloc,

Of course, here’s a new fly in the ointment. How would I sort on this if I go the list on card route? For any given card, the list will likely never be more than 20 entries. However, I’m stuck on how to sort the unread to the top for a given user.

Filtering should be straightforward as I’m looking for a current user not in list condition.

Thank you for the input thus far.

I would have to play around with it to be sure, but you should be able to use the merged with operator to merge two searches in the repeating group’s data source. So, do a search for cards where the card’s list does not contain the current user, and merge that search with a search for cards where the current user is in the card’s list.

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