dreamRs / shinyWidgets

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

`updateAirDateInput` does not fully overwrite `disabledDates` #700

Open ZIBOWANGKANGYU opened 4 months ago

ZIBOWANGKANGYU commented 4 months ago

When using updateAirDateInput to update disabledDates for multiple times, new updates do not fully overwrite old updates. Instead, if a date has been disabled by an old call to updateAirDateInput, it will stay disabled even if it is not included in the disabledDates in a new call to updateAirDateInput.

Repex:

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  airDatepickerInput("date_input", "Pick a date"),

  actionButton("disable_date", "Disable date")
)

# Define server logic required to draw a histogram
server <- function(input, output, session) {
  click_count <- reactiveVal(0)
  observeEvent(input$disable_date, {
    updateAirDateInput(inputId = "date_input", options = list(
      disabledDates = (Sys.Date() + click_count()) # After each time clicking "disable_date", only one date should be disabled. The previously disabled date should be enabled again. But this is not the case. Previously disabled dates remain enabled. 
    ))
    click_count(click_count() + 1)
  })
}

# Run the application 
shinyApp(ui = ui, server = server)
pvictor commented 3 months ago

Hello, Thanks for reporting, should be fixed if you re-install from GitHub.

Victor

ZIBOWANGKANGYU commented 2 months ago

Can confirm that problem has been fixed in v0.8.6.9100