I have a page that displays the number of pets of the current user. After clicking on "Delete , one pet of the current user is removed from the database. The problem is that on the page, the number of pets is only updated after the page reloads. I have a question, why the number is not updated in real time?
Hi there, @olgahvesko… one way you can go here is to put the text element in a group, set the group’s type of content to number and set its data source to the search for cats with the count, and have the text element display the Parent group's number. Then, when the button is clicked, delete the thing from the Cats data type, and add another action that displays data in the group, with the data to display being the same search with the count.
Sorry, I didn’t quite understand that sentence “and add another set that displays data in the group, with the data to display being the same search with the count”.
I did this, but maybe it’s not the right one
Although your method does not work when you click the “Delete” button again. I recorded a video. For some reason, the program incorrectly identifies the first element: I have it lapka1, but the program writes that the element to delete lapka2
What you are trying to do should be super easy. I mean, you are simply trying to delete something and then get a count of the remaining items… it doesn’t get much more basic than that in Bubble. But why are you using first item or last item? Don’t you want to delete a specific thing instead of just the first or last item? What are you trying to do from the user’s perspective?
It makes no sense how the number drops by 2 in your video. If anything, I might expect the number to stay the same because I guess it’s possible that the second action in the workflow could complete before the system is able to search for and delete the item in step 1 (which is why what you are actually trying to accomplish might matter because maybe you don’t need to be searching for an item in step 1). But again, I have no idea why the number would drop by 2. You could try inserting a pause between the first and second steps to see if that helps.