A developer friend told me that sometimes using the client side workflows will reap faster user responses than the server side API workflows. All I am asking is some general guidelines, when should I use client side workflows and when should I do it the API workflow way for maximum web app speed?
To make things more interesting, I am inviting you all to my app. This is what you have to do to recreate the problems I am facing:
- Go to : https://qingdom.bubbleapps.io/version-test?debug_mode=true
- Click on “Ask”.
- Ask any question and submit.
- Go to Moderate.
- Click on ONIT button for the question you created…
All I need to know is WHY this button has a delay in response. Should I move all the button workflows to the API workflows?
Briefly what I am doing: I am creating a 99% user moderated Q&A with many new features not existing in current Q&As, such as ranking based on credibility points, and vote power based on ranking, and a self contained system where all the power is shifted to the users/community who operates the Q&A. The only job of the original moderator/developer is to guarantee that the system keeps just and fair for anyone to ask any kind of questions as long as there is consensus on the contents.
I am currently in the very early stages, creating the main moderation modules for the questions.
Ok, if some people think I am not contributing on the forum to other peoples’ concern because I am a selfish person, that is not correct. The reason is that I simply do not know the answer to their questions as I myself am a beginner. I wish I knew the answer.
Back to my topic, I have found the reason for the lag and I bet many many beginners will fall in this same mistake sooner or later so I decided to share. So as I was optimizing my app I made a very important discovery that to advanced users they will take it for granted but for beginners they will simply not know.
The solution is to make sure to use the “Use Results of Previous Step” as much as you can in the workflows so buttons won’t take time to process their work on bubble. As an example I will put my case:
User clicked on WorkingOnIt button and a a field called WorkingOnSomething for CurrentUser is set to Yes if the CurrentUser WorkingOnSomething is No.
What I previously did in Step 2, 3, 4, 5 etc… was I checked WorkingOnSomething=Yes on each step to make sure that the end user can only click the button once. But the correct way is to use “The Result of Previous Step” as much as I can so that Bubble does not intensively try to process the same amount of bits again and waste time.
This is my first discovery in this topic, as I find more insights I will share again. But the answer was not to move everything to API workflows as some suggested before. That should be done only (in my opinion) in Steps where “Do Search For” and editing lists are made, and I will yet to find out.
Enjoy your day
Ok, after optimizing the performance of my SPA (Single Page Application) buttons and workflows with the previous method described, I have made even higher performance feats through Custom States. Again, unfortunately it is a highly undervalued feature in Bubble that doesn’t receive a lot of attention when it comes to performance tuning.
Simply stating, I have deleted ALL MY database fields that I formerly used as temporary variables, and used CUSTOM STATES as temporary variables to calculate current user data with amazing results.
Formerly the app was taking a lot of time to perform actions because in the workflows there was a lot of database fetching of data, that happens AFTER the user clicks a button. However, in the new logic design when the user loads a page (moderation module) most the variables he will need to click the buttons are already pre-loaded or pre-defined in custom state variables ready to be used by the other buttons (WorkingOnIt, Upvote & DownVote).
So pre-loading database based fields in custom state (temporary variables) before the user takes an action seems to be a very very efficient way to run the app. It takes zero time to run.
Hi @arto.eg - welcome to Bubble. Glad you figured out the solution to your problem.
Yes, part of the challenge with learning something new is “you don’t know what you don’t know”. So a person can spend a lot of time searching the forums, ask questions (sometimes without responses) and end up without an answer (simply because, unbeknownst to them, they don’t know what question to ask).
On my journey to learn Bubble, I was making progress with my first app but there was a queue of issues I wasn’t getting addressed in a timely manner. I reached out to @romanmg (Gaby) over a year a go for her consulting services and she helped me out a lot. And in our meeting she noticed the app I was working on was a mobile app, but I hadn’t set it up as an SPA. I didn’t know what I didn’t know but she knew my app wasn’t setup correctly and gave me direction (which saved me a ton of time and rework - and frustration!)
The take-away is time is money and sometimes you need to reach out for help (beyond just posting in the forum - which is a great free resource). I’m fortunate now to have some clients where I can look at their app and point them away from sub-optimal design choices.
Best wishes on your Bubble journey!
Agree, and I will reach out for help when I urgently need it. I am documenting all what I discover here so that when others search for the same questions they can find the answers… as I actually did search for answers when others asked before me.
Thank you! I’ve redesigned my database a few times now since there’s one workflow that takes up a large amount of time. The very next thing I was thinking of trying was using custom states to pre-load the data.
Thank you for this! I’ll definitely implement this ASAP.