dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
826 stars 153 forks source link

`updateAirDateInput()` does not update value if no options provided #690

Closed merlinoa closed 5 months ago

merlinoa commented 5 months ago

The following app does not update the value of the airDatepickerInput when the action button is clicked. The value remains blank, but if you uncomment the options = list(maxDate = Sys.Date()), then the input is updated correctly.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  fluidRow(
    column(
      12,
      airDatepickerInput(
        "date",
        "Date"
      ),
      actionButton(
        "set_date",
        "Set Date"
      )
    )
  )
)

server <- function(input, output, session) {

  observeEvent(input$set_date, {

    updateAirDateInput(
      session,
      "date",
      value = Sys.Date(),
      #options = list(maxDate = Sys.Date())
    )

  })

}

shinyApp(ui, server)

Session info:

R version 4.3.3 (2024-02-29)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.6.8

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shinyWidgets_0.8.4 shiny_1.8.1.1     

loaded via a namespace (and not attached):
 [1] digest_0.6.35     later_1.3.2       R6_2.5.1          httpuv_1.6.15     fastmap_1.1.1     magrittr_2.0.3    cachem_1.0.8     
 [8] htmltools_0.5.8.1 lifecycle_1.0.4   promises_1.3.0    cli_3.6.2         xtable_1.8-4      sass_0.4.9        jquerylib_0.1.4  
[15] withr_3.0.0       compiler_4.3.3    rstudioapi_0.16.0 tools_4.3.3       bslib_0.7.0       mime_0.12         Rcpp_1.0.12      
[22] jsonlite_1.8.8    rlang_1.1.3  
pvictor commented 5 months ago

Thanks for reporting this. This has been corrected in the version available on GitHub. On the other hand, I've just published it on CRAN an hour ago, so we'll have to wait a bit before we can put a new version up.

merlinoa commented 5 months ago

Great thanks! Yes, I can confirm, it is fixed in the latest version on github