The problem is that if the function shiny::updateTabsetPanel were to change, which it did when going from version 1.5.0 to version 1.6.0 of shiny, the function updateTabItems would not also change since it is set at the time the package is compiled. This is problematic when using an renv package cache or when deploying content to Posit Connect which also uses a package cache since there is only one installation of a given version of a package.
This can result in unexpected behavior, where the two function definitions will not match:
Verify shiny::updateTabsetPanel does not have the default set for session in the function definition.
Install shinydashboard0.7.1. Don’t upgrade any other packages when prompted.
devtools::install_version("shinydashboard", "0.7.1", repos = "cran.rstudio.com")
Restart R.
Verify shinydashboard::updateTabItems does not have the default set for session in the function definition.
Verify shiny::updateTabsetPanel does have the default set for session in the function definition.
Verify shinydashboard::updateTabItems still does not have the default set for session in the function definition.
Restart R.
Reinstall shinydashboard0.7.1. Don’t upgrade any other packages when prompted.
devtools::install_version("shinydashboard", "0.7.1", repos = "cran.rstudio.com")
Restart R.
Verify shinydashboard::updateTabItems now does have the default set for session in the function definition.
Perhaps a better way to implement the function would be as follows:
According to this line, the function
updateTabItems
is exactly the same function asshiny::updateTabsetPanel
. https://github.com/rstudio/shinydashboard/blob/7ccaacce9a5ec76ff204229385d724b6b9e0b82f/R/tabs.R#L83The problem is that if the function
shiny::updateTabsetPanel
were to change, which it did when going from version1.5.0
to version1.6.0
ofshiny
, the functionupdateTabItems
would not also change since it is set at the time the package is compiled. This is problematic when using anrenv
package cache or when deploying content to Posit Connect which also uses a package cache since there is only one installation of a given version of a package.This can result in unexpected behavior, where the two function definitions will not match:
Here is a complete set of steps for how to reproduce the issue in an R project.
Create a project in RStudio or Workbench with
renv
enabled. Set therenv
settinguse.cache
tofalse
.Restart R.
Install
devtools
install.packages("devtools", repos = "cran.rstudio.com")
Restart R.
Install
shiny
1.5.0
devtools::install_version("shiny", "1.5.0", repos = "cran.rstudio.com")
Restart R.
Verify
shiny::updateTabsetPanel
does not have the default set forsession
in the function definition.Install
shinydashboard
0.7.1
. Don’t upgrade any other packages when prompted.devtools::install_version("shinydashboard", "0.7.1", repos = "cran.rstudio.com")
Restart R.
Verify
shinydashboard::updateTabItems
does not have the default set forsession
in the function definition.Restart R.
Install
shiny
1.6.0
devtools::install_version("shiny", "1.6.0", repos = "cran.rstudio.com")
Restart R.
Verify
shiny::updateTabsetPanel
does have the default set forsession
in the function definition.Verify
shinydashboard::updateTabItems
still does not have the default set forsession
in the function definition.Restart R.
Reinstall
shinydashboard
0.7.1
. Don’t upgrade any other packages when prompted.devtools::install_version("shinydashboard", "0.7.1", repos = "cran.rstudio.com")
Restart R.
Verify
shinydashboard::updateTabItems
now does have the default set forsession
in the function definition.Perhaps a better way to implement the function would be as follows: