Multi-page app load speed

I have a multi page app that I am finding has a slow initial page load speed.

My question - when the app is first visited, do all the callbacks from all the pages trigger, or is it just the callbacks from the currently active page that triggers? If they all trigger, is there a way to disable this?

There are 10 pages, all of which are pulling data from an AWS RDS db, and uploading it to a datatable component and a chart.

thank you

In my experience it is only the active pages that are loaded. You could easily check this yourself with a print statement when the callback is triggered.

1 Like

Hi @anarchocaps

You can speed the load time if you also set suppress_callback_exceptions=True

app = Dash(__name__, use_pages=True, suppress_callback_exceptions=True)

If you exclude this, pages will automatically create a app.validation_layout for you under the hood, which can slow the load time. (More info here)

Note that if your page layouts are functions, it may still be slow, however this will be fixed in the next release (2.6.2) coming soon.

3 Likes

Thanks @AnnMarieW .

My layouts are currently functions in other modules, that I am importing into the module with the callbacks.

When the update arrives, will the update make using layout as a function the same speed as using app.layout directly, or will there still be a difference between the two of them?

thank you