glin/reactable

Reactable pagination switches to page one on selection with crosstalk object

msaltieri opened this issue · 1 comments

Hi @glin and thanks for the nice work!

I'm not sure if this is an issue with reactable or with crosstalk but I'm raising it just because it's a pretty annoying bug.

When utilizing a crosstalk object within a reactable featuring row selection, an unexpected behavior occurs where, upon selecting a row on a page greater than 1, the reactable pagination immediately switches to page one.

Thank you for any help you could provide!

Reproducible example

library(shiny)
library(crosstalk)
library(reactable)

ui <- fluidPage(
  titlePanel("Test Reactable With Crosstalk"),
  fluidRow(
    column(
      12,
      reactableOutput("tab")
    )
  )
)

server <- function(input, output) {
  data <- SharedData$new(cars)
  output[["tab"]] <- renderReactable(
    reactable(
      data = data,
      selection = "multiple"
    )
  )
}

shinyApp(ui = ui, server = server)

Expected Behavior

The pagination should not switch to page one upon selecting a row. The selected row should remain highlighted, allowing the user to continue interacting with the reactable on the current page.

Actual Behavior

Upon selecting a row on a page greater than 1, the pagination immediately switches to page one.

Session Info

version  R version 4.3.2 (2023-10-31)
os       macOS Sonoma 14.0
system   x86_64, darwin20
ui       RStudio
language (EN)
collate  it_IT.UTF-8
ctype    it_IT.UTF-8
tz       Europe/Rome
date     2023-11-24
rstudio  2023.09.1+494 Desert Sunflower (desktop)
pandoc   2.15 @ /usr/local/bin/pandoc

Additional Information

glin commented

Hi @msaltieri, thanks for the report. I think it's a bug in reactable. I've got a test branch up with a possible fix that I still need to confirm, but you could try it if you're able to install a development version: https://github.com/glin/reactable/compare/crosstalk-select?expand=1