Skip to content

[Bug]: Redundant filter in merge_srv #277

@gogonzo

Description

@gogonzo

What happened?

Please check the app and see that dplyr::filter(Species %in% c("setosa", "versicolor", "virginica")) is executed even if not needed

options(teal.log_level = "DEBUG")

devtools::load_all("teal.data")
devtools::load_all("teal.transform")
devtools::load_all("teal")


data <- within(teal.data::teal_data(), {
  iris <- iris
  mtcars <- mtcars
})

app <- init(
  data = data,
  modules = modules(
    modules(
      label = "Testing modules",
      tm_merge(
        label = "non adam",
        picks = list(
          a = picks(
            datasets("iris", "iris"),
            variables(
              choices = c("Sepal.Length", "Species"),
              selected = "Species"
            ),
            values()
          )
        )
      )
    )
  )
)

shinyApp(app$ui, app$server, enableBookmarking = "server")

To determine if filter is needed:

  • selected is different than possible-choices.
  • possible-choices is different term than choices. choices can be set by app-developer using values(choices) and they can be different than original choices. It means that selected != choices is not the same as selected != possible-choices.
  • with above it is non-trivial or "expensive" in terms of a design to achieve this, but perhaps one can find a good way

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions