I’ve implemented a “Like” system in my app where clicking the like button creates a Like record, and clicking it again (if already liked) deletes that record — effectively unliking the post.
Everything works fine without a page reload: the like and unlike actions reflect immediately in the UI.
However, there’s a strange behavior when I reload the page:
After clicking “Like”, the record is created properly.
I then reload the page.
When I click again to unlike:
The Like record is correctly deleted from the database (confirmed in the data tab).
But the button’s visual state does not update immediately — it still shows as if it’s “liked”.
Sometimes, clicking again creates a second like, even though there should be only one per user/publication.
After manually reloading the page again, everything appears correct.
It seems like Bubble is caching the result of the Search for Likes query, and not updating it after the deletion — at least not fast enough to reflect in the interface.
I’ve tried:
Displaying data again in the repeating group or cell.
Filtering from a list of Likes loaded at page load.
Using :count > 0, :first item is not empty, and :some item's publication is current cell's publication for conditional display.
Preventing duplicate Likes using conditional checks before creation.
None of these fully solved the issue when a page reload is involved before unliking. Has anyone run into this before, and found a way to force the UI or the search to refresh properly after a delete action?
Actually, several people have been reporting this as well as seeing this myself too. I think it is actually a bug that needs to be reported. It’s something wrong with the conditional. @fede.bubble
This shouldn’t be an issue. But it is an issue as of today. Saw this when creating a test app for someone as well. Had to do a weird workaround to get it to work.
You could try not hard deleting the Like record, but creating a Flag field “Deleted” (yes/no) and marking the deleted Like as deleted = yes. Then only show likes where deleted = no.
Alternatively you could have a Likes field (“list of Users”) on the Post, and add/subtract Users from this list (the only caveat being this list cannot hold more than 10,000 values).
ps I think this has been normal behaviour as long as I can remember (since 2020!)
Thank you very much!
Everything is working perfectly now using your method with a yes/no field.
I needed something flexible, so a list wouldn’t have worked for me.
Thanks again and Thanks for everyone who tried to help🙏