Skip to content

Commit a87428b

Browse files
committed
Only output one warning in Gene (static); fix returning of plots when downloading from the app. Closes #83
1 parent a2b9662 commit a87428b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

R/app_server.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ app_server <- function(input, output, session) {
224224
})
225225

226226
static_gene <- reactive({
227-
gene_warnings = NULL
227+
gene_warning = NULL
228228
withCallingHandlers({
229229
p <- vis_gene(
230230
spe,
@@ -258,10 +258,10 @@ app_server <- function(input, output, session) {
258258
)
259259
}
260260
}, warning = function(w) {
261-
gene_warnings <<- c(gene_warnings, conditionMessage(w))
261+
gene_warning <<- conditionMessage(w)
262262
invokeRestart("muffleWarning")
263263
})
264-
return(list(p = p_result, gene_warnings = gene_warnings))
264+
return(list(p = p_result, gene_warning = gene_warning))
265265
})
266266

267267
static_gene_grid <- reactive({
@@ -455,7 +455,7 @@ app_server <- function(input, output, session) {
455455
height = 8,
456456
width = 8 * ifelse(input$side_by_side_gene, 2, 1)
457457
)
458-
print(static_gene())
458+
print(static_gene()[['p']])
459459
dev.off()
460460
}
461461
)
@@ -483,7 +483,7 @@ app_server <- function(input, output, session) {
483483
height = 8 * isolate(input$gene_grid_nrow),
484484
width = 8 * isolate(input$gene_grid_ncol)
485485
)
486-
print(static_gene_grid()['p'])
486+
print(static_gene_grid()[['p']])
487487
dev.off()
488488
}
489489
)
@@ -560,13 +560,13 @@ app_server <- function(input, output, session) {
560560
# Since 'static_gene()' is invoked twice (once also in the assignment
561561
# of 'output$gene'), we silence any errors that occur in this second
562562
# invocation to not duplicate error messages
563-
these_warnings = NULL
563+
this_warning = NULL
564564
temp = try(
565-
{ these_warnings = static_gene()[['gene_warnings']] }, silent = TRUE
565+
{ this_warning = static_gene()[['gene_warning']] }, silent = TRUE
566566
)
567567

568-
if (!is.null(these_warnings)) {
569-
paste("Warnings:", paste(these_warnings, collapse = "; "))
568+
if (!is.null(this_warning)) {
569+
paste("Warning:", this_warning)
570570
} else {
571571
""
572572
}

0 commit comments

Comments
 (0)