Hey all,
I have an app that does the following:
- gets available data from db
- lets user select data he wants (multiple samples)
- for each selected sample data it
A. optimizes a fit for the curve
B. plots the data, the fitted curve, some settings - Merges all plots together and shows a merged plot and a table of results
- Allows uploading the results into the db
- Sidebar with settings to control plots and other settings
The fitting and plotting part is time consuming, and each widget interaction leads to a rerun of the app, and it runs the fitting function again and again
All functions (including the fit function) are cached and should not rerender and rerun on every iteration
It is very time consuming when i have a lot of samples selected, but also for a few samples, widget changes should not cause a rerun of the whole app.
I’ve tried implementing logger to print every function rerun and time it, but i still cannot find which part is not cached and causes a rerun of the whole app…
I’ve tried using st.fragment which solves the rerun problem, but changes of the widgets (on sidebar for example) now do not affect the fragments and also the 4th point above is affected, when changing each separate plot, it does not affect the merged plot.
Minimal reproducible example is almost impossible since it is a huge app and I am lost trying to find what causes the reruns
Can anyone shed light on what could be causing it? Ideas on how to debug and find what causes the rerun?