Forum Academy Marketplace Showcase Pricing Features

Conditions on elements - do they slow performance?

I’ve looked around and most topics on performance seem to cover conditions on workflows/actions but I’ve not seen much on conditions on individual elements. For example, my use case is with fonts and font size. So in order for me to allow a variety of fonts to be displayed, I have to set up a LOT of conditions on a text element: When Current User’s Font is (font name) > Font > (font). Same with font size. So currently as it stands, a single text element has about 45 conditions for a variety of fonts. It’s a lot of work on my part but if it gives my users options I will do. I’ve sadly found no work around nor am I coding savy so it is what it is. Now, I’m concerned about what this many conditions can do on performance… especially if several text elements have these… any ideas? With the font size and font type conditionals I’d be looking at at least 60 conditions per element.

If anyone has a lifesaving workaround for this, I would also LOVE to hear it.

Thanks a lot!

Conditions do add to the total code base that has to be downloaded on page load, so yes, they do technically slow your app down. Using conditions here and there won’t make much of a difference, but 60 on a single element can start to be noticeable, especially if that goes for multiple elements. I’d try to find alternate solutions for that.

The conditions you’re talking about here are mostly done client-side though, so individually they should be pretty fast. You can read more about the difference between the two in this article. So it’s not the condition in itself that’s a cause for concern here, but more about the sheer number of them.

1 Like