crosstalk
crosstalk copied to clipboard
Reactable Pagination Switches to Page One on Selection in Crosstalk Object
Issue description
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. This behavior is not in line with the anticipated user experience.
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(
data.frame(id = 1:50, value = rnorm(50))
)
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-22
rstudio 2023.09.1+494 Desert Sunflower (desktop)
pandoc 2.15 @ /usr/local/bin/pandoc
Additional Information
- Crosstalk version: 1.2.0.9000 (rstudio/crosstalk@d754a21)
- Reactable version: 0.4.4
- Shiny version: 1.7.5.1
I can't seem to reproduce the behavior, would you mind sharing a screen recording of the behavior?
Also, it seems like a fix for this should ultimately come from {reactable}
(thank you for filing https://github.com/glin/reactable/issues/349)
Hi @cpsievert and thanks for your quick feedback. The bug is even present on the official reactable
documentation page in the Cross-Widget Interaction section.
I have recorded this short clip from there:
https://github.com/rstudio/crosstalk/assets/26568338/3b2ef4f0-8360-4a07-95d6-32b6b96091b0
Let me know if you need more information or a different reprex. If I can help in any way, I would like to make myself available to support you in solving the problem.
Ahh, it appears that this behavior is only reproducible if you don't select rows on the 1st page...
Exactly! It's like the reactable
object refreshes itself after the first click.
And this behavior only happens when a crosstalk
object is passed to the widget. Trying with a classic data.frame
doesn't produce the bug.