arbeitsgruppe-digitale-altnordistik / Sammlung-Toole

A new look on Handrit.is data
https://arbeitsgruppe-digitale-altnordistik.github.io/Sammlung-Toole/
MIT License
0 stars 0 forks source link

For step-based workflows in GUI use a `st.empty()` #117

Open BalduinLandolt opened 2 years ago

BalduinLandolt commented 2 years ago

The current implementation of steps is rather clumsy.

Essentially, where ever st.experimental_rerun() is called, that is, because we want to get rid of the previous step. But that way, we need to keep track of steps by using the steps in the state handler, and need to persist search results and stuff there too.

With a Streamlit's empty container, we could solve this in a much simpler way, as it allows to get rid of previous stuff by simply clearing the container. Then no re-run is required any more, thus no steps and intermediate data is needed either. So we should be able to get rid of this, if not the entire StateHandler as a whole.

kraus-s commented 2 years ago

This is proving more difficult to accomplish. Nested buttons, i.e. buttons that are nested in multiple instances of with st.something, will by default trigger a rerun. This cannot be prevented and is the very session states were implemented in the first place. Sort of forgot about that myself. So we will still need the state handler. However, we can greatly reduce complexity by using st.empty(). Not sure about getting rid of all of the st.experimental_rerun() instances BUT: What we can do is get rid of the meta functions, that select the search or result function and instead combine those in the search function, which will check, if there are results and then empty the container and fill it with the results container. Alternatively, the container could live at the level of the meta function and be filled with either content.

BalduinLandolt commented 2 years ago

ah... how I hate this fiddly state stuff in streamlit! xD
but reducing the complexity of the search stuff will be an improvement in and by itself. Feel free to implement it the way that seems best to you. (Given you find time for it, that is, of course 😄 )

kraus-s commented 2 years ago

I spent some time on it today and I would perhaps put this on the back burner for a version 1.x. It is very finicky to implement and not a huge improvement in user experience. If we really want this done well, we'll have to gut large parts of the search page.

Balduin Landolt @.***> schrieb am So., 25. Sept. 2022, 20:39:

ah... how I hate this fiddly state stuff in streamlit! xD but reducing the complexity of the search stuff will be an improvement in and by itself. Feel free to implement it the way that seems best to you. (Given you find time for it, that is, of course 😄 )

— Reply to this email directly, view it on GitHub https://github.com/arbeitsgruppe-digitale-altnordistik/Sammlung-Toole/issues/117#issuecomment-1257253054, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANZXABEUSQML2MCNVAMHXXDWACL6ZANCNFSM6AAAAAAQUTLOQI . You are receiving this because you were assigned.Message ID: <arbeitsgruppe-digitale-altnordistik/Sammlung-Toole/issues/117/1257253054@ github.com>