cedricvlt / streamlit-condition-tree

A Streamlit component to build a condition tree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Condition Tree does not accept updated config when using a key

matt-gree opened this issue · comments

When setting a key for the condition_tree(), upon rerunning the app and updating the config (i.e. table changes), the dropdown of available fields does not change. Even deleting the session state key before calling condition_tree() does not change the available fields.

Code:

config = config_from_dataframe(table)

# Optional, does not affect results
if 'condition_tree' in st.session_state:
        del st.session_state['condition_tree']

 query_string = condition_tree(config,
        min_height = 400,
        placeholder = 'No rules created',
        always_show_buttons = True,
        key = 'condition_tree'
        )

Basically, even if my table changes in this code, the condition tree will still hold on to the old config. This does not happen when not using a key. My intention with using the key is to be able to save the query and recall it at a different time.