Delete thing SLOW

I currently have a list of items for our customers to chose from. See attached image.

Adding items it lightning quick however deleting lags and isn’t nearly as quick as adding. I understand why, there is more logic in deleting than there is in adding but I’m wondering if anyone might have pointers on how I can make it as efficient as possible?

At the moment, when the user clicks the negative numbers to bring the count down I launch a WF that searches into the check out records. I have a constraint that filters in all the items that match the item listed and that share the same slug. I then chose one at random and delete it. I chose random to remove any additional logic of sorting the list and finding the first or last in the list. This seemed to improve it a little but not much. Sometimes the number goes down after the loading bar zooms by. Sometimes I have to refresh to get the real count. Certainly not very snappy.

The slug is important as we want to use it as “sessions” so a user can’t go home and continue to place orders from their phone long after leaving our restaurant. We achieve this by setting the page’s type of content to a list of tables and changing the slug so it’s always unique to each customer visit. I also have an on page load verifier to make sure there is a valid slug. Otherwise the user is kicked out.

I understand that a much simpler approach would be to use states (or variables) I have this functioning in another test page. The reason we want to avoid this is to allow the group at the table to work on their order together. As far as I understand and as far as tests show, the state cannot be slug centric so each person at the table would have a blank for item counts and wouldn’t be able to build the order with their peers.

Anyone have thoughts on this one?

I think it’s hard to see your settings actually and make a correct recommendation for your case.
Actually I’m pretty sure that there’s thing you can improve to make it faster. The first thing is the search you are using. Pretty sure it’s a long way to something that should be a lot more simple.

If you can make your app in Public view mode, Pretty sure that someone can take a look and give some idea.

You can also consider Bubbl coaching for this kind of stuff.

thank you Jici. I have set my app to public viewing. Not sure how you get to it though? Still new at this.

The page in question is “menu_single_page” and the button in question is “DeleteItem”.

You need to share Editor link so we can see how you have set thing in backend

This is the app link not the editor one. So we can see the front end but not the backend

1 Like

Second times is the charm??

I think you need to review your app DB/settings and WF.
I will start from your setting and try to explain you why.
The first thing is that, each time you click +, this create a new checkout. If user have 20 beers, this mean that 20 items was created. More item created, more data to load, slower it will be. You should instead add +1 to a quantity field in checkout item instead of creating more and more.
Second thing, actually to link checkout to table, you are using a text field. This mean that each time you want to find the checkout items that belong to the current table, you use a Doa search. Do a search is slower and shouldn’t be use in your case.

What I recommend is:
Add a List of Checkout field in your Table DB. This way you will not need to use a Do a search to get linked checkout item.
Put the + Number input and - into a new Group. Set this group to “checkout” data type. And Use Current page table’s checkout: filtered by (menu item is current cell menu item)
Add condition to this group that will be also something like: Current page table’s checkout:filtered by (menu item is current cell menu item)'s unique id is empty. This element is visible (leave checkbox empty). This will hide the group if there’s no checkbox created.
The + should ahve the workflow: Make change to thing: Parent’s group checkout: Quantity = This checkout quantity +1. - will be Make change to thing: Parent’s group checkout: Quantity = This checkout quantity -1. you can consider adding another step: If Step 1 quantity is 0: Delete a thing : Parent group checkout
You can use autobinding for the number input field on parent group quantity field or you can use a WF that Trigger on Input value has changed. Make change to thing: Parent group checkout, quantity = This input value. Add step 2 like for - so if user enter 0… it will delete the checkout.
Finally, Add a new + (but not in the group witjh + number and -) but in current cell. + Will create a thing checkout: Set menu item current cell menu item and quantity to 1, make change to thing: Current page table, checkout list add Step1 created checkout. Add a condition to the +: When group that contain + number - is visible: This element is visible (unchecked).

This way, no do a search everywhere, everything got linked together and you don’t need to create a thing for all each item that represent only 1 quantity.

This is wonderful! Thank you so much for working this through for me. The issue is that I’m a relational DB guy and this quickly went way over my head as I’m not used to Bubble’s way of doing thing. We’re going to have to peel this onion layer by layer.

So first things first, add a list of Checkout field. Sounds good. But are you saying you want me to create a field called “List of checkout” under my data types: Checkout? Or are you saying you want me to create a whole new data type simply called “List of Checkout”? If it’s the former (as I suspect it is) I’m guessing you’re wanting me to check the “This fields is a list (multiple entries)” check box? If it’s the latter then I’ll have more questions.

Second, I don’t understand why I’m putting the + and - in its own group. How will I be able to tie to each menu item’s own count? I don’t know much about Bubble so it must just be a concept that’s over my head. The rest of this I’m following all the way to the autobinding. Don’t know what that is but lets baby step it.

Once again, thank you so much for digging into this with me.

Add a list of checkout “field” in Table DB.
In Table, go, click on add field, give it a name, in Type, select Checkout. Click the checbox this is a list. Because this will be a list :stuck_out_tongue_winking_eye: of related checkout to this table.

Actually, your RG is a list of menuitems. This is ok, but if you want to reference the current table checkout item, You will need to use a group. Because the +, number and - element are related to checkout, and not to menu items, this is why I suggest you to put that in a Group that will get data from the current table checkout, but using :filtered to know which checkout things is related to the current menuitem.

It’s not easy to explain (and to understand ;). But pretty sure that you can start to explore this option and work from that.

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