Dynamic Page - Page load optimization

Hello everyone,
I have a quite intense dynamic page (item) with multiple iframes (> 10) utilizing data retrieved from an external DB. As the page’s complexity grew the performance has started to suffer – initially I thought this was because of all the external data requests. However, after several tests - it seems the performance is being hampered by the way Wix loads (or rather reloads) the iframes.

My sense is that the whole point of a dynamic page was that we could have data driven pages and so am not sure why Wix keeps reloading the various UI elements – as from a UX standpoint – it would make sense not to reload the UI elements but rather update the contents in the UI elements (or iFrames) based on the current index of the dynamic dataset.

Any thoughts on if there is any way to prevent the UI elements / iFrames being reloaded again and again for various data collection items ?
Thanks in advance.

Why use so many iframes on your pages to begin with?

Why not just connect an external database.
https://support.wix.com/en/corvid-by-wix/external-database-collections-1023416

Or use Wix Fetch or Wix HTTP Functions instead.

https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api

https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions

Iframe code can be written any which way, so yes it can behave the way you want them to in theory, but in practice you’ll have to write all the code yourself and add some sort of variable that tells you if it’s the first time the iframe is being loaded, and potentially override any domain switch listeners.

I say in practice, because I doubt you wrote the code for all of the iframes, and third party code is often closed off. You could try creating a router and see if that helps at all, but there’s no guarantee as iframe code is not Corvid.

I agree with whiskey above…beyond being inefficient, it’s a potential security nightmare.

Thanks @GOS, @skmedia

Perhaps my question was not clear - I am inquiring if there is a way to setup a dynamic page such that Wix does not reload the UI elements when the dynamic dataset page changes. The default behavior currently when wix transitions to another item (ie the associated dynamic page) is that it reloads all the UI elements (an inefficient approach in my view when the whole point of dynamic page is that we are using a template to display items). I would prefer that instead of reloading all UI elements there was just the equivalent of sending a post message to the iFrames (though I would like the URL to reflect the specific item).

Combining responses on some of the questions posed:

  1. Reason for so many iframes is because it is a custom analytics heavy site and each iFrame has a different set of analytics engine / visualization
  2. External DB is already connected and yes already using fetch and http functions
  3. Code for iframes is mine - not third party

@tabraham Instead of changing the dynamic page (loading a new instance from the dataset) You could manually operate the change by updating the element that require change (or change the dataset currentItem).

Would that be a solution?

If it is your code and analytics, you can always also just lazy-load them after the page is functional. Also, since it is your code, I imagine you should be able to condense it all into just one iframe? If you need to compartmentalize whatever messages you’re sending to it, it would be easy to just post an object message:
{ iframe1:{}, iframe2: {}, etc… }

@plomteuxquentin thanks - indeed and this is my current solution – however, what I do not like about this as mentioned above is that the user does not see a specific URL as I have to essentially show a generic URL. This is because, the moment I transition to a truly dynamic page with a dynamic URL - Wix forces the reload of the UI elements.

Thanks @skmedia - I had tried that – but unfortunately wix still penalizes the load and slows it down (because of the number of iframes). Unfortunately, it is not possible to condense all of it into just one iFrame, it would make maintaining and managing it a nightmare given the very different analytics displayed within them.

Thanks again - you have been very kind with your time - much appreciated.

@tabraham I didn’t know it was a display portal for analytics. In that case maybe you can try the router? It should bypass a lot of Wix bloat and load at least a bit faster, and you may be able to pull the data server-side so you can feed it to your iframes instead of fetching it client-side.

@skmedia thanks David. Agree, definitely something to explore when I get a bit more time on my hands.
Unfortunately, Wix doesn’t make it easy to copy complex page UX designs – and the router functionality requires me to re-create my current Dynamic Page within the ‘Router’ page structure. Wish there was an easy way to duplicate a dynamic page with the UX and move it into the ‘Router’ page structure. Thanks again!

@tabraham You should have the option of removing the dynamic page tag from your page, duplicating it, and then you can set one as your dynamic page again and add the other to the router for testing.

@skmedia apologies for delay in response (wix notifications have not been working since I changed my contact email).

Re: your suggestion – it unfortunately doesn’t work for my dynamic page which has a lot of different UX elements. It just copies a few elements and then gives up on the rest. Thanks again.