Skip to content

Commit

Permalink
fix validate/req in srv_variable_browser
Browse files Browse the repository at this point in the history
  • Loading branch information
gogonzo committed Nov 22, 2023
1 parent ba34e97 commit 1e27413
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,9 @@ srv_variable_browser <- function(id,
})

output$ui_numeric_display <- renderUI({
validation_checks()
dataname <- input$tabset_panel
varname <- plot_var$variable[[input$tabset_panel]]
req(data(), varname)

varname <- plot_var$variable[[dataname]]
df <- data()[[dataname]]

numeric_ui <- tagList(
Expand Down Expand Up @@ -354,10 +353,9 @@ srv_variable_browser <- function(id,
})

output$ui_histogram_display <- renderUI({
validation_checks()
dataname <- input$tabset_panel
varname <- plot_var$variable[[input$tabset_panel]]
req(data, varname)

varname <- plot_var$variable[[dataname]]
df <- data()[[dataname]]

numeric_ui <- tagList(fluidRow(
Expand Down Expand Up @@ -1038,8 +1036,8 @@ is_num_var_short <- function(.unique_records_for_factor, input, data_for_analysi
#' @keywords internal
validate_input <- function(input, plot_var, data) {
reactive({
dataset_name <- input$tabset_panel
varname <- plot_var$variable[[input$tabset_panel]]
dataset_name <- req(input$tabset_panel)
varname <- plot_var$variable[[dataset_name]]

validate(need(dataset_name, "No data selected"))
validate(need(varname, "No variable selected"))
Expand All @@ -1053,7 +1051,7 @@ validate_input <- function(input, plot_var, data) {

get_plotted_data <- function(input, plot_var, data) {
dataset_name <- input$tabset_panel
varname <- plot_var$variable[[input$tabset_panel]]
varname <- plot_var$variable[[dataset_name]]
df <- data()[[dataset_name]]

var_description <- var_labels(df)[[varname]]
Expand Down

0 comments on commit 1e27413

Please sign in to comment.