insightsengineering / insightsengineering/teal.slice
[Bug]: Opening the `Available filters` clears the filter state completely + It does not display slices to select from.
- Dominant language
- R
- Stars
- 12
- Forks
- 7
- Avg merge
- 3d 31m
- Merged PRs (30d)
- 1
Description
### What happened?
In a **non-teal shiny app** with the filter panel, clicking the `Available filters` clears the active filters initialised during init. Maybe this is not a bug and it has to do with how the initial state was set because the clearing bug is gone after new filters are added after it's been cleared like this.
The second bug is that the available filters are not rendered.
### Example app to test
```r
library(shiny)
library(teal.slice)
datasets <- init_filtered_data(list(iris = iris, mtcars = mtcars))
ui <- fluidPage(
fluidRow(
column(
width = 9,
dataTableOutput("iris_table")
),
column(width = 3, datasets$ui_filter_panel("filter_panel"))
)
)
server <- function(input, output, session) {
datasets$srv_filter_panel("filter_panel")
set_filter_state(
datasets = datasets,
filter = teal_slices(
teal_slice(dataname = "iris", varname = "Species", selected = "virginica", keep_na = FALSE)
)
)
iris_filtered_data <- reactive(datasets$get_data(dataname = "iris", filtered = TRUE))
output$iris_table <- renderDataTable(iris_filtered_data())
}
shinyApp(ui, server)
```
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct.
### Contribution Guidelines
- [X] I agree to follow this project's Contribution Guidelines.
### Security Policy
- [X] I agree to follow this project's Security Policy.
Contributor guide
Assessment
This issue has not been assessed yet.