Saving environment from temporary state of Shiny app when using browser() ?

I find the browser() function very helpful for debugging my Shiny app. However, when I want to do some major modifications to my code using existing elements from a temporary state of my app (created using browser()) as input, I can't because they all disappear as soon as I finish running the app. Can I save all elements of this temporary state?

For example, if there are 20 data frames in my Environment produced by my Shiny app (which I can view thanks to browser() and which will go away after the app is resumed), can I save all of them in some convenient way?

something like
assuming you are browsered into a function in your shiny app, and you have named objects you want to see the values of (i.e. if you have some input$something you have mapped it to a standalone name local_smth <- input$something then you could write out the objects in the current environment like so

save(list = ls(all.names = TRUE), file = "myname.RData", envir = rlang::current_env())
1 Like