Keep results when switching between tabs


Is there a way that when I switch between tabs my results are not rerun, but they be static, so in other words;

when I change the tab it would rerun the results again, I use persistence for filters/dropdowns not to change but
the graph/table is still being calculated when changing the tab. The result is the same but still annoying that it’s rerunning each time.

I would like the results are static


There are a few ways to do it. The simplest one is to use the “Method 2” from the documentation, where the tab contents are not added and removed from the layout (so your graph won’t recalculate) via a callback. Instead, they are just “hidden” or “visible” depending on the tab selection.

The downside of using this approach is that it computes all callbacks related to components in all tabs when the app start, but for fast callbacks this should not be a bottleneck.

Another approach is to use dcc.Store to cache the graph/table. It is a more complicated way and I am happy to elaborate if needed, so let me know if the first one doesn’t work for you.

Hope this helps! :slightly_smiling_face: