Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] attr(data, "code") is not reactive #722

Closed
Tracked by #45
gogonzo opened this issue Aug 22, 2022 · 5 comments
Closed
Tracked by #45

[BUG] attr(data, "code") is not reactive #722

gogonzo opened this issue Aug 22, 2022 · 5 comments
Assignees
Labels
bug Something isn't working core discussion

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Aug 22, 2022

Our list of datasets with "code" attribute is buggy. Each dataset is reactive but code don't change when the data changes. It means that filter-panel code changes are not reflected in the "Show R code".

Possible solutions:

  • data should be a formal class (can be S3) with reactive code. Should be easy to initialise. I propose to refactor teal.data classes to be something which holds data+code+keys only as all additional methods are not necessary in modules. This means that cdisc_data(...) can be passed also to the modules. Other scenario is to create a new class (e.g. module_data)
  • attr(data, "code") can be a reactive()
  • instead list or reactive datasets we can have reactive list of datasets.
@gogonzo gogonzo added the bug Something isn't working label Aug 22, 2022
@Polkas
Copy link
Contributor

Polkas commented Aug 22, 2022

In my opinion data with preprocessing code which is static, should be independent of FilterPanel.
The filter panel code could be added in the module with method like filter_panel_api$get_expr().

We should think about passing the data as unfiltered one to module, and the filter_panel_api (available in the module) will be filtering this data and returning the needed expr for the quosure.

# Sth like
tm_x_srv <- function(data[unfiltered], filter_panel_api) {
    data_filtered <- filter_panel_api$apply_filtering(data)
    quosure <- new_quosure(data) %>% eval_code(filter_panel_api$get_expr())
}

regarding "so you have a separate copy of the data for each module", we could reuse already available data sth like
https://www.tutorialspoint.com/design_pattern/flyweight_pattern.htm
In practice it could be even the r memoise.
if one module ask for filtered data it is cached and the second module (no filtering changes made) use this cached data

@nikolas-burkoff

@donyunardi

This comment was marked as outdated.

@donyunardi donyunardi added bug Something isn't working and removed bug Something isn't working labels Aug 22, 2022
@Polkas

This comment was marked as outdated.

@donyunardi

This comment was marked as outdated.

@donyunardi
Copy link
Contributor

After installing the packages properly, I am able to reproduce it.
Since this bug is related to our quosure update, we will have to prioritize this within this increment.
Adding discussion label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core discussion
Projects
None yet
Development

No branches or pull requests

4 participants