Skip to content

Commit bd3e07b

Browse files
committed
fix: show original error
1 parent 2b76b4d commit bd3e07b

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

R/tm_g_distribution.R

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ srv_distribution <- function(id,
930930
input$scales_type
931931
input$qq_line
932932
is.null(input$ggtheme)
933-
input$tabs
934933
},
935934
valueExpr = {
936935
dist_var <- merge_vars()$dist_var
@@ -946,9 +945,6 @@ srv_distribution <- function(id,
946945
scales_type <- input$scales_type
947946
ggtheme <- input$ggtheme
948947

949-
req(input$tabs == "QQplot")
950-
teal::validate_inputs(iv_r_dist(), iv_dist)
951-
952948
qenv <- common_q()
953949

954950
plot_call <- if (length(s_var) == 0 && length(g_var) == 0) {
@@ -994,7 +990,7 @@ srv_distribution <- function(id,
994990
plot_call <- substitute(
995991
expr = plot_call +
996992
stat_qq(distribution = mapped_dist, dparams = params),
997-
env = list(plot_call = plot_call, mapped_dist = as.name(unname(map_dist[t_dist])))
993+
env = list(plot_call = plot_call, mapped_dist = as.name(unname(map_dist[req(t_dist)])))
998994
)
999995

1000996
if (length(t_dist) != 0 && length(g_var) == 0 && length(s_var) == 0) {
@@ -1246,7 +1242,7 @@ srv_distribution <- function(id,
12461242

12471243
decorated_output_dist_q <- srv_teal_transform_data(
12481244
"d_dist",
1249-
data = req(output_dist_q),
1245+
data = output_dist_q,
12501246
transformators = decorators
12511247
)
12521248

@@ -1265,12 +1261,19 @@ srv_distribution <- function(id,
12651261
}
12661262
})
12671263

1268-
dist_r <- reactive(decorated_output_dist_q()[["plot"]])
1264+
dist_r <- reactive({
1265+
req(output_dist_q()) # Ensure original errors are displayed
1266+
decorated_output_dist_q()[["plot"]]
1267+
})
12691268

1270-
qq_r <- reactive(decorated_output_qq_q()[["plot"]])
1269+
qq_r <- reactive({
1270+
teal::validate_inputs(iv_r_dist(), iv_dist)
1271+
req(output_qq_q()) # Ensure original errors are displayed
1272+
decorated_output_qq_q()[["plot"]]
1273+
})
12711274

12721275
output$summary_table <- DT::renderDataTable(
1273-
expr = if (iv_r()$is_valid()) decorated_output_q()[["summary_table"]] else NULL,
1276+
expr = if (iv_r()$is_valid()) decorated_output_dist_q()[["summary_table"]] else NULL,
12741277
options = list(
12751278
autoWidth = TRUE,
12761279
columnDefs = list(list(width = "200px", targets = "_all"))
@@ -1281,7 +1284,8 @@ srv_distribution <- function(id,
12811284
tests_r <- reactive({
12821285
req(iv_r()$is_valid())
12831286
teal::validate_inputs(iv_r_dist())
1284-
decorated_output_q()[["test_table"]]
1287+
req(test_q()) # Ensure original errors are displayed
1288+
decorated_output_dist_q()[["test_table"]]
12851289
})
12861290

12871291
pws1 <- teal.widgets::plot_with_settings_srv(

0 commit comments

Comments
 (0)