Problem creating Shareable links

I am trying to create a “share” feature that copies a URL to the users clipboard so they can provide the link to others. The intended behavior is that the page loads with all the relevant state, and that the user who receives the share link can then modify the state which is loaded from the URL.

So far, I am able to save variables to a URL, and load them to render the streamlit app. However, when a user makes any change, the state “resets”. it looks like this is because I clear the query string after reading it. I do this because I need the state to be modifiable, rather than be stuck on the content loaded from the share link.

Any suggestions for how to accomplish the “sharable content” idea while also allowing users to modify the state of the shared content AND prevent the page from resetting when they make a change?


Relevant streamlit app: