reactable.extras
reactable.extras copied to clipboard
[Bug]: dropdown_extra() keeps values in memory even if reactable source data changes
Guidelines
- [X] I agree to follow this project's Contributing Guidelines.
Project Version
0.2.0
Platform and OS Version
No response
Existing Issues
No response
What happened?
if a value is changed using dropdown_extra()
, then the value persist on the table even if the source data of my reactable changes.
Steps to reproduce
- Create a reactable with dropdown_extra() and with a data source that can change.
- Modify some values with dropdown
- Change data source and see that changes from step 2 persist
Expected behavior
I was expecting these values to be "flushed" when the data changes. Or maybe a mechanism to force the refresh
Attachments
library(shiny)
library(reactable)
library(reactable.extras)
df1 <- MASS::Cars93[1:4, 1:3]
df2 <- MASS::Cars93[5:8, 1:3]
shinyApp(
ui = fluidPage(
reactable_extras_dependency(),
selectInput("data", "Data", c("df1", "df2")),
reactableOutput("react"),
),
server = function(input, output) {
df <- reactive({
if (input$data == "df1") {
df1
} else {
df2
}
})
output$react <- renderReactable({
reactable(
df(),
columns = list(
Type = colDef(
cell = dropdown_extra(
id = "dropdown",
choices = levels(df()$Type),
class = "dropdown-extra"
)
)
)
)
})
}
)
Screenshots or Videos
https://github.com/Appsilon/reactable.extras/assets/46813298/a32c4476-4852-4a91-b82d-31e53ee7bf7a
In this example I changed the values "Type" to "Van" on the first 2 lines in df1. When I switch to df2, the 2 first lines have a "Van" "Type" which is not the case in the dataset.
Additional Information
No response