I have a repeat which displays a database table called file_descriptions. This is a record of images stored in my S3 storage. It looks like this:
so the general format of the repeat part of the code is like this:
repeat file_descriptions
variable show_image
display of file_title
[Show Image] icon to display the image - sets show_image=1
display of file_url
conditional_region viewed when show_image.value==1
image tag with src taken from file_descriptions
When I click on the [Show Image] icon, it immediately displays the conditional region but then takes about 20 seconds before it goes off to download the image from the url and display it. The actual image download then only takes a few hundred ms and the image appears.
Is this a bug, a feature, or am I doing something wrong?
I am using a conditional_region rather than show/hide because I don't want to download all the images... only the one or two the user wants to actually view.
Here is the source code of the conditional region:
Try using separated pages. If you have millions of Dynamic expressions on the page that are not boxed in conditional regions they will. E evaluated over and over again on each change.
So having a SPA with dynamic content views or separate pages is a much better solution
It is true that there are areas of my app where a lot is going on, (I dispute the "millions" statement!) but those pages had not been populated with any data when the problem I am having occurs.
I know my app very well, and everything else on the page I'm dealing with displays immediately, so I am still very confused about why Wappler takes soooo long just to decide to go off and display the image. Can you or @patrick help me to understand that?
(I would say having one page or lots of pages is a topic for another post. I'd love to hear the team and community's view on the pros and cons of each approach, as no one method is ever utopia!)
Iām not sure why youāre seeing such a delay, but a different approach for displaying āconditionalā images is suggested here. Iām not sure if it will work with images hosted on Amazon; I expect it could.
My knowledge of the inner workings of Wappler are extremely limited, but my experience has been that when I think āThing Aā is causing a performance issue, what is really happening is that the Overall Page Performance has degraded, and it is just being exposed by Thing A.
Iāve also had good luck moving formatting to the server when possible ā the client side formatters seem to run constantly so when there are hundreds of elements, issues arise. Again, just my experience, not any secret inside knowledge of Wappler ā so keep that in mind!
Yes Ken, that makes a lot of sense... and I do experience that when there is complex code displaying a lot of data.
But in this case, the whole app is running like clockwork, super smooth, until it comes to the conditional region displaying the image. To go from 100ms to 20 seconds for something to be displayed is such a massive difference, and is only when use the conditional region, it leads me to believe that something strange is going on with Wappler!
That sounds like a great plan I hadn't thought of for some other issues I have had, so I will bear that idea in mind. Thanks!
It could be that this CR is turning out to be the next dynamic component that would overflow DMX - hence degrading the performance.
Just to test, maybe add a CR somewhere else on the page and see if that breaks the performance too?
Folks, Thanks for your input and your sense that it must be my app and not Wappler.
Iām open to all ideas!
What I can say is that the app still runs perfectly okay at normal speed after this happens. And all works speedily if I use show/hide, and that causes all the images to download.
Hence my belief something strange is happening with the CR!