-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
654 pass reactive data@main #674
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments from me
R/module_nested_tabs.R
Outdated
args <- c(args, datasets = datasets) | ||
} | ||
|
||
is_data_used <- isTRUE("data" %in% names(formals(modules$server))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_reporter_used
works on module
and modules
objects (it's an S3 method) we should probably rename is_reporter_used to is_module_arg_used
and pass in "reporter"
, "dataset"
, "id"
etc. so we get consistent behaviour here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will need is_module_ui_arg_used and is_module_srv_arg_used to cover all scenarios. Or add an argument is_module_arg_used(..., type = "srv" or "ui")
.
@nikolas-burkoff @Polkas @mhallal1 @kpagacz # 1. use expr, join_keys argument
srv_custom <- function(data = list(...), expr = <expr>, join_keys = <join_keys>, ....)
# 2. use attributes
srv_custom <- function(data = structure(list(...), expr = <expr>, join_keys = <join_keys>, ...)
# 3. use nested list
srv_custom <- function(data = list(data = list(....), expr = <expr>, join_keys = <join keys>, ...) Together with @pawelru we think that nested list (3) is to "complicated" to put reactive data into
Please let me know what is your opinion about this. |
Code Coverage Summary
Results for commit: 54545cf Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments from me
@@ -88,9 +88,35 @@ ui_nested_tabs.teal_modules <- function(id, modules, datasets, depth = 0L) { | |||
#' @export | |||
#' @keywords internal | |||
ui_nested_tabs.teal_module <- function(id, modules, datasets, depth = 0L) { | |||
stopifnot(is(datasets, "FilteredData")) | |||
checkmate::check_class(datasets, "FilteredData") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this check into the if-statement
in line 95 to avoid checking for it when not needed.
is checkmate::assert_class
needed for a more strict check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ui_nested_tabs
needs FilteredData
and FilteredData
will still be delivered here for a long time in the same shape. nested_tabs is the place where convertion from FIlteredData -> data happens.
Also, nested_tabs is not exported also which means that we don't have to simplify api for this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ui_nested_tabs
needs FilteredData
and FilteredData
will still be delivered here for a long time in the same shape. nested_tabs is the place where convertion from FIlteredData -> data happens.
Also, nested_tabs is not exported also which means that we don't have to simplify api for this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passing data
and datasets
to the same module seems to be possible also, is this by design?
if (exists("progress")) { | ||
progress$set(message = "Getting R Code", value = 1) | ||
progress$close() | ||
str_filter <- teal.slice::get_filter_expr(datasets, datanames) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, a few minor comments. I'll let @mhallal1 approve as he's been much closer to this than me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
closes #654
data
argument. I'm passing the list with attributes as I think it's easier thanlist(data = list(ADSL = reactive(), ...), attributes = list(expr = reactive(), ...))
....
. We can ease this requirement because some modules might not need datasets at all. inui_nested_tabs
andsrv_nested_tabs
we usedo.call
which passargs
by their name (doesn't care about order)I found some inconsistency. For example:
Sample app
Sample app with lightweight reproducible object