From the example below, I would expect the display of user input to only update every 2s (2000ms). But it's not, it's updating just as fast as when I don't include a debounce statement.
if (interactive()) {
options(device.ask.default = FALSE)
ui <- fluidPage(
textInput(inputId = "text",
label = "To see how quickly..."),
textOutput(outputId = "text")
)
server <- function(input, output, session) {
text_input <- reactive({
input$text
})
debounce(text_input, 2000)
output$text <- renderText({
text_input()
})
}
shinyApp(ui, server)
}
You have to assign the result of the debounce()
call and use that in your output:
server <- function(input, output, session) {
text_input <- reactive({
input$text
})
text_d <- debounce(text_input, 2000)
output$text <- renderText({
text_d()
})
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With