-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Q: Should decorator show error from upstream teal_data
(pre-decorated) in the UI?
#1421
Comments
teal_data
in the UI?teal_data
_(pre-decorated)_ in the UI?
teal_data
_(pre-decorated)_ in the UI?teal_data
(pre-decorated) in the UI?
On the application below, we see a problem in Adverse Effects, which has errors coming from the encoding panel, but those are being shown in the decorator library(teal)
decorator <- teal_transform_module(
label = "Head",
ui = function(id) shiny::checkboxInput(shiny::NS(id, "head_check"), "Show only first 6?", value = FALSE),
server = make_teal_transform_server(
quote({
if (isTRUE(head_check)) iris <- head(iris, 6)
})
)
)
# Example below
init(
data = teal_data() |> within(iris <- iris),
modules = module(
label = "Sample module",
ui = function(id, decorators, ns = shiny::NS(id)) {
shiny::tagList(
shiny::tags$h4("🔵 Input with default encoding error"),
shiny::checkboxInput(ns("check_me"), "Simulate error in data", FALSE),
shiny::tags$h4("Decorator:"),
ui_transform_teal_data(ns("decorator"), transformators = list(decorator)),
shiny::tags$hr(),
shiny::tags$h4("Output:"),
shiny::verbatimTextOutput(ns("text"))
)
},
server = function(id, data, decorators) {
moduleServer(id, function(input, output, session) {
table_q <- reactive({
if (isTRUE(input$check_me)) {
data
} else {
within(data, stop("Corrupted qenv with encoding error"))
}
})
decorated_data <- srv_transform_teal_data("decorator", table_q, transformators = decorators)
output$text <- shiny::renderPrint({
req(table_q())
decorated_data()[["iris"]]
})
})
},
ui_args = list(decorators = list(decorator)),
server_args = list(decorators = list(decorator))
)
) |> shiny::runApp()
|
A possible solution:
|
Is this not related to the discussion that we have here? And the conclusion was
Doesn't this mean the issue that's being raised here is as designed? |
@donyunardi I think this is a bit different this time, please check @averissimo example from the opening of this issue |
It's a bit different, but similar to the |
@kumamiao error appeared on an Encoding Panel, since one of the inputs is missing. Error message got propagated to the decorator UI. The question is, should we show an error in decorator UI or not, if the error comes from Encoding Panel. |
Using the example without
X
andY
We might want to add a custom wrapper on
srv_teal_transform_data
that will return the original data if that has an error.Originally posted by @averissimo in insightsengineering/teal.modules.general#797 (comment)
The text was updated successfully, but these errors were encountered: