Fast clicking generates multiple database entries

I have a bookmarking feature in my app, which lets users bookmark posts of other users. When clicking on the bookmarking icon, a workflow is triggered that (i) creates a new thing “Archive” (in which I save the bookmarked post), (ii) hides such icon and (iii) shows a different icon (in the same position where the first icon was). When the user clicks on this second icon, the opposite workflow is triggered.

This works perfectly well if a user clicks back and forth in a reasonable manner, i.e. with approximately 2 seconds between the two clicks. However, if a user clicks on the (alternating) icons pretty fast and multiple times, the workflows seem to be too slow and the database gets filled with multiple entries of the same archived post.

Of course, such fast clicking is not normal user behavior, but if a user indeed clicks in a frenzy, this causes all kinds of problems…

Has anyone experienced this as well? Is there a way to avoid that fast clicking by users triggers multiple identical workflows?

Any help would be highly appreciated!

I’ve not done this in bubble, but in other software I’ve worked on in the past we would artificially restrict this by making both buttons inactive for a short time period. We’d mask it with a happy animation or something, but the net result was that the user was literally not able to click on stuff that fast. Depending on your target user, a spiffy animation or flourish may or may not be appropriate, but it’s great when building stuff for elementary students!

1 Like

I have noticed this as well. It usually reverts but why it happens escapes me. A bug perhaps

How about using modify a thing, and check create if the thing doesn’t exist, instead of creating a new thing?

1 Like

Good idea, but I can’t modify a thing “Archive” as the page’s/element’s type of content is “Post”.

@emmanuel Is there a solution to this problem? Thanks!

We can’t tell like this out of context. if it’s a bug please file a bug report.

Why can’t you modify it by finding it in a search?

After re-reading your post, it sounds like this might be a better solution…

I’m not sure why you’re creating an “archive” if its the same data as the original post. It sounds like you’re trying to save a list of favorited posts to the current user, in which case you should create a field called something like “favorite_posts” as a list of posts on the user data type.

Your icon would have two workflows attached to it.

  1. When the button is clicked, and when the current user’s “favorite_posts” doesn’t contain the post - make a change to the current user, favorite posts, add post.

  2. When the button is clicked and when the current user’s “favorite_posts” contains the post - make a change to the current user, favorite posts, remove post.

Also, put a conditional on the icon so that you don’t have to create two. "When the current user’s favorite_posts contains current cell’s post use icon 2.

Thanks. I tried with the “modify” approach, but this doesn’t work either…

Of course, I would love to save the post in a list of posts to the current user (which would be much simpler), but the problem is that lists are limited to 1’000 things (https://bubble.io/reference#Data.Messages.list), which means that users could only bookmark 1’000 posts…

Will have to file a bug report and see if the Bubble team can do something… the easiest would be if in the workflow an action could be added which blocks the user from clicking for a fraction of a second.

As a follow up to this, Emmanuel told me that the Bubble team is going to raise the 1’000 limit soon and that the limit will actually go away in the coming months. Problem solved!

1 Like