Goal
Faster development of shiny-related R packages through app hot reloading1.
Problem
We build a Shiny app following this procedure:
Change the app code.
Launch it.
Interact with the app to bring it to a state that allows us to see the effects of the latest changes.
Evaluate the behavior of the app.
Close it and go all the way back to step 1 if we’re not done yet.
This launch-interact-close cycle is expensive, unnecessary friction. We could instead:
Launch the app [once].
Bring it to a state that allows us to see the effects of the changes we’re about to make [once].
Change the app code.
Evaluate the behavior of the app and go back to step 3 if we’re not done yet.
Traditional solution
Use the shiny.autoreload option so that Shiny relaunches the app automatically whenever its code changes.
Configure automatic bookmarking to preserve the application state across reloads.
Shortcomings of the traditional solution
This approach does not work for modular Shiny applications prior to shiny 1.11.0. Thanks to the efforts of Garrick Aden-Buie, this is no longer an issue.
This approach still fails to fully hot-reload applications developed as part of an R package.
Manually adapting apps for hot-reloading is cumbersome. Cleaning the reloading-related code for publication is also a chore.
Proposed solution
Launch your unmodified Shiny app through our short and flexible app hot reloader script.
App reloading that preserves app state.