(performance question) Is it better practice to: Have 1 element with 100 conditionals, or 2 elements with 50 conditionals?

So this is for my app with currently about 200 users where I’ve already gotten complaints of things being slow. Unfortunately bubble doesn’t support dynamic font styles so I have to do a massive workaround. I work alone so I’d appreciate your guys’ thoughts. Not sure how to handle this…

Essentially, my app allows users to choose fonts dynamically for a design they send me to print.

So to do this, I save the name of the font into my database and set a conditional on the text element to change its font to xyz based on whatever it was saved to be. So "When current text’s font_style(text field) is “Open sans”… then I change the font to Open sans. That’s it, same for font size. So total about 50 conditionals currently with font choices and font sizes.

However… when they’re trying different styles, they need to see how it’s gonna look before actually saving it. So I also have to allow the font and font size to change based on what they’re trying at the time WITHOUT actually saving it into the database. This means I have to double every single conditional. I think it’s impossible to have both cases work within a single conditional. I tried so hard.

Everything works fine but I’m worried about performance as this would mean 120-170 conditionals on a single element. So ultimately this comes to the question for you folks… would it be fine to have all these conditionals on a single element? Or, is it preferable having a separate elements show for each case?

TLDWR/SUMMARY: If you HAVE to have 100+ conditionals to display custom states and database based stuff on an element, is it better to have it on the same element, split it into 2 elements (one shows when something is being edited, the other one shows when it’s not), or it makes no difference? In such case, it’s easier to do it on the same element.

I will be ultimately filling out about 220 conditions manually or more so this means a lot. But beyond the manual work, performance is my biggest concern. Kindly cast your vote!

I think if you go with 2 elements 50 diffrent conditions
or
1 element with 100 different conditions
or
100 elements with 1 condition each

in all the above cases bubble has to do same amount of work because all these conditions are getting checked in the frontend. So the performance will depend upon users device.

I think instead you should find a plugin or any Api service that returns you the text in your desired form. So that we can take the font conversion feature from users system to backend (may be)
Honestly, I am a little confused so please take this suggestion with a pinch of salt.

Custom CSS is the solution here. Do not put 100 conditionals on elements. I mean, you can, but that’s painful when CSS exists!

3 Likes

Can you please elaborate this

Just don’t try and do this because this doesn’t even make sense.

Create a CSS style in the page header that applies to relevant text elements in your page. e.g a CSS snippet that applies to elements with HTML ID beginning with dynamic-text that sets the font-family to the relevant fontID from your database (dynamic data)

3 Likes

@georgecollier you are absolutely right. I think i was overthinking, Yeah their are several videos available on youtube on how to inject custom CSS in bubble.io and Chad GPT can write the CSS code very easily.
Sorry for wrong information @julpereira82

Nevertheless, I am curious for the answer to the performance question - not that it’s useful at all (if you have 50 conditionals on an element you’re probably doing something wrong / in a way that could be better)…

1 Like

Oh… my GOD man I’m beyond… happy… that I came here. I almost didn’t. Today probably drastically changed the course of our project and our capabilities so profoundly. Frankly I am embarrassed now that I even considered 200+ conditions (all 3 parts each), or 400+ total when added to the other elements or more.

So, I never even considered CSS because it seemed “intimidating” and I though it was too much. I even commented here it was too much for me. Well. Not anymore.

I just played around with it for about 2 hours now and researched and let me tell you… I can’t express how huge of a discovery this is for me and our team. Not only will I not have to do that awful awful, dear godly awful workaround… I also discovered CSS!!! (INCREDIBLE for my use case!!!) AND I accidentally found the solution for something I was looking for 2+ years ago for a feature I just canceled about two months ago. I know all you did was suggest CSS haha but I am beyond happy. Thank you… I was certainly living under a rock…

7 Likes

I appreciate the suggestion though frankly I abstain from anything chat gpt related as the intellectual property aspect today with AI and chat gpt is essentially a free for all undeveloped wild west… I’d be wary of including potentially protected intellectual property into anything made. Technically, everything chat gpt tells you and gives you belongs to Open AI… so whatever they decide to do in the future I guess it is. I do enjoy it for other more personal use cases however :slight_smile:

:slight_smile:

Not true. But I’m glad you were able to work it out nonetheless.

1 Like

No… that’s 100% completely factually incorrect…

But even if it was true… basic CSS can’t be copyrighted…

Chat GPT is pretty useless for a lot of things… but simple web code (html, CSS, JavaScript) is one of its major strong points… (although not without fault)…

In my opinion, you’d be crazy to dismiss Chat GPT for things like this.

4 Likes

Well as you mention it. I did just re grow curiosity for this and re-checked, this is what I found under “Content” in their terms if you’re curious too. I’m no legal expert of course, just my personal take on it if anyone else is curious too. Not legal advice of course…

“Content found on or through this Service are the property of Chat AI GPT or used with permission. You may not distribute, modify, transmit, reuse, download, repost, copy, or use said Content, whether in whole or in part, for commercial purposes or for personal gain, without express advance written permission from us.”

So in other words, they’re telling you everything chat gpt returns is their intellectual property, you are never in any way or form provided a license, permission, or even any sort of acknowledgement of YOUR intellectual property in relation to theirs… you are also explicitly told not to use it without their express consent. That’s already kinda bad in my opinion. Not only that, whatever account you use to prompt chat gpt is a perfect transcript and documentation of chat gpt’s role in the development of intellectual property related to your project and even your own derived work potentially, even if not directly prompted. In the end, this may imply intellectual ownership of some sort to an unknown extent in relation to your own, and that to me is quite a gray area… all they tell you is “this is ours do not use it”. If to top it all off, you have zero documentation of your own intellectual work’s development over time… well. Who knows. Maybe it’s alright, maybe not. We’re exceptionally early to even remotely know how these cases are gonna stand 5-15 years from now. When/if it ever gets to paint, microsoft-word, wordpress-like terms in terms of intellectual property, then yeah might reconsider. For now… eh.

I think AI is too new still and the courts are surely gonna make a loooot of growth in the next decades with all these new companies coming out from chat gpt/ai…

Though sure, they can’t just cause ruin and missery because a lot of their supporters actually help them grow… nonetheless, you are not favored here and build a very strong case (in my opinion) for violating their terms of service, which can end a plethora of ways…

You linked chataigpt.org’s TOS. That is not OpenAI’s TOS.

I’ll just leave this here.

OpenAI hereby assigns to you all its right, title and interest in and to Output. This means you can use Content for any purpose, including commercial purposes such as sale or publication, if you comply with these Terms. OpenAI may use Content to provide and maintain the Services, comply with applicable law, and enforce our policies. You are responsible for Content, including for ensuring that it does not violate any applicable law or these Terms.

3 Likes

That’s not OpenAI’s terms.

2 Likes

Well… I was indeed wrong again.