Skip to content

Commit 0ce7a6d

Browse files
author
Ryan Patrick Kyle
committed
🔪 has_reloaded, 🐫
1 parent 9549326 commit 0ce7a6d

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

R/dash.R

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ Dash <- R6::R6Class(
187187
private$app_root_path <- getAppPath()
188188
private$app_launchtime <- as.integer(Sys.time())
189189
private$meta_tags <- meta_tags
190-
private$has_reloaded <- FALSE
191190
private$in_viewer <- FALSE
192191

193192
# config options
@@ -721,15 +720,7 @@ Dash <- R6::R6Class(
721720
# private$last_cycle will be set when the cycle-end handler terminates
722721
#
723722
if (!is.null(private$last_cycle) & !is.null(hot_reload_watch_interval)) {
724-
if (!private$has_reloaded)
725-
# allow reloading on first change, then compare against the hot_reload_watch_interval
726-
# to control whether future reloads are permitted on cycle end
727-
permit_reload <- TRUE
728-
else {
729-
# determine if the time since last reload end is equal to or longer than the requested check interval
730-
# (Sys.time() - private$last_reload) provides time in seconds, same units as hot_reload_watch_interval
731-
permit_reload <- (Sys.time() - private$last_reload) >= hot_reload_watch_interval
732-
}
723+
permit_reload <- (Sys.time() - private$last_reload) >= hot_reload_watch_interval
733724
} else {
734725
permit_reload <- FALSE
735726
}
@@ -820,7 +811,6 @@ Dash <- R6::R6Class(
820811
rstudioapi::viewer(paste0("http://", self$server$host, ":", self$server$port))
821812
# tear down the temporary environment
822813
rm(app_env)
823-
private$has_reloaded <- TRUE
824814
}
825815
}
826816
}
@@ -867,11 +857,10 @@ Dash <- R6::R6Class(
867857
app_root_modtime = NULL,
868858

869859
# fields for controlling hot reloading state
870-
last_reload = NULL,
860+
last_reload = numeric(1),
871861
last_refresh = NULL,
872862
last_cycle = NULL,
873863
modified_since_reload = NULL,
874-
has_reloaded = NULL,
875864

876865
# field to store whether viewer has been requested
877866
in_viewer = NULL,

0 commit comments

Comments
 (0)