Can streamlit component tell if this render is caused by rerun or other things?

I am building a component that need to send back some info to streamlit backend on every rerun while preventing the rerun it caused(which will trigger a loop), is this possible?

Thanks, @bbyk - welcome to our forums!

I think I’d need to get a bit more info in order to provide some more detailed diagnosis.

That said, Session State may well be what you need to build your component:

Session State is a way to share variables between reruns for each user session. In addition to the ability to store and persist state, Streamlit also exposes the ability to manipulate state using Callbacks. Session state also persists across apps inside a multipage app.

You can find more information about session state in our docs here.

Let me know if that helps,
Charly

I don’t think this is possible with a component, no – if you return a different value from the component, it will trigger a rerun. Depending on what you want the component to do, it might be possible to accomplish what you’re trying to do in other ways.

Thanks, @blackary - good to know!

I think that in any case, we’d need to get more info about what @bbyk is trying to build! :smiley:

Charly

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.