Hello, I am confused on how to implement a number field that periodically is refreshed.
This is how my code currently looks
st.session_state[“Hi”] = fetch()
st.number_input(“Enter value”, key=“Hi”, on_change=write_to_server)
st.autorefresh(4)
I need to have the fetch before the number input so that it correctly renders new changes, but how do I write logic to avoid that section when I change the value in the field? When I do this, it reruns the page and there is literally no way I can think of nor enough time for the code to indicate to this rerun that the fetch should be avoided (otherwise it will overwrite any changes the user just made and make it an entirely pointless field). The code also needs to run until the st.number_input before the key:value change is reflected in session_state, and I can’t change anything after the number field because the session state can’t be changed after an element is rendered, even if I’m changing it for the next run.
Any help is appreciated