Call this before your Shiny inputs are created, and when they are created, they will prepopulate themselves to the values contained herein. For example, if you call restore_inputs(x = 3), and then subsequently a numericInput("x", "x", 5) is created, the created input will default to 3 instead of 5. Note that each call to restore_inputs completely replaces any bookmarkable state, or previous calls to restore_inputs.

restore_inputs(..., session. = shiny::getDefaultReactiveDomain())

Arguments

...

Named arguments, where the names are input names (don't forget to use namespaces if you're using modules!) and the values are default values for the corresponding inputs.

session.

The current Shiny session.

Value

session., invisibly.

Details

restore_inputs is designed to be called from (the beginning of) a Shiny server function, and as such, can only affect inputs created on the server side (generally using renderUI or insertUI).