dfalbel commited on
Commit
e4947cc
1 Parent(s): 8191af0

reduce the number of messages upon failure.

Browse files
Files changed (1) hide show
  1. app.R +2 -1
app.R CHANGED
@@ -95,7 +95,7 @@ server <- function(input, output, session) {
95
  # Observer used at app startup time to allow using the 'Send' button once the
96
  # model has been loaded.
97
  observe({
98
- if (sess$is_loaded) return()
99
  cat("Loading model:",sess$sess$poll_process(), "\n")
100
  invalidateLater(1000, session)
101
 
@@ -107,6 +107,7 @@ server <- function(input, output, session) {
107
  }, onRejected = function(x) {
108
  shinyjs::disable("send")
109
  insert_message(paste0("😭 Error loading the model:\n", as.character(x)))
 
110
  })
111
 
112
  NULL # we return NULL so we don't stuck waiting for the above.
 
95
  # Observer used at app startup time to allow using the 'Send' button once the
96
  # model has been loaded.
97
  observe({
98
+ if (is.null(self$is_loaded) || sess$is_loaded) return()
99
  cat("Loading model:",sess$sess$poll_process(), "\n")
100
  invalidateLater(1000, session)
101
 
 
107
  }, onRejected = function(x) {
108
  shinyjs::disable("send")
109
  insert_message(paste0("😭 Error loading the model:\n", as.character(x)))
110
+ self$is_loaded <- NULL # means failure!
111
  })
112
 
113
  NULL # we return NULL so we don't stuck waiting for the above.