Reactivity problem with rhandsontable

I have a shiny app which extensively uses rhandsontable (rhot) with great success. For each rhot I have an associated reactiveVal() which allows me to respond to user inputs as well as programmatic changes to the rhot data, similar to the reprex below. I have a problem with one of my rhots where the user can select multiple rows. Because of delays in the app, if the user makes more than one selection change this gets overwritten when the rhot refreshes. Does anyone know how i can prevent this? I want to allow the user to make multiple selection changes. Thanks!

PS I tried using a longer debounce but this makes the app feel unresponsive.

library(shiny)
library(rhandsontable)

btable0 <- data.frame(LETTERS = LETTERS, SELECT = FALSE)
  
ui <- fluidPage(
  rHandsontableOutput("btable")
  )

server <- function(input, output, session){
  
  btable <- reactiveVal(btable0)
  
  output$btable <- renderRHandsontable({
    rhandsontable(btable())
  })
  
  input_btable <- reactive(input$btable)
  
  delay_btable <- debounce(input_btable, 250) 
  
  observeEvent(delay_btable(), {
    bt <- hot_to_r(delay_btable())
    bt %>% filter(SELECT) %>% print()
    btable(bt)
    Sys.sleep(1) # do something
  })
  
}

shinyApp(ui, server)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.