Does if/else widget impact the performance of my app?

I'm creating a pet adoption app and I have a page where I display different pets. If no image is uploaded for the pets, I want to have a default image, but I want different default images for different pets - for example cats will have a cat icon, dogs a dog icon etc. 

I see no other way to do this other than with an if/else widget, because the default image can't be defined by a variable. But I have like 10 different options (dog, cat, turtle, bird etc.) and the performances of this page are awful. It takes forever to load. Is this the issue or is something else causing the issue? Is there a better way to do this?

Thank you in advance for your answer!

Solution

Hi Jana,

using a If widget will only render the valid branches, not the whole structure.

Since you are using a mobile version I suspect you are loading the images directly from the server database and not from local storage, that should have a high cost in terms of performance. Moreover verify the size of the images, in mobile it makes a lot of difference reducing a few kbs.

Regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.