@@ -650,7 +650,7 @@ Dash <- R6::R6Class(
650
650
server_on <- TRUE
651
651
652
652
while (server_on ) {
653
- if (self $ config $ hot_reload == TRUE && file.exists(file.path(getAppPath(), " assets " )) ) {
653
+ if (self $ config $ hot_reload == TRUE ) {
654
654
self $ server $ on(' cycle-end' , function (server , ... ) {
655
655
current_asset_modtime <- modtimeFromPath(private $ assets_folder )
656
656
current_root_modtime <- modtimeFromPath(getAppPath(), recursive = TRUE )
@@ -662,26 +662,29 @@ Dash <- R6::R6Class(
662
662
663
663
initiate_reload <- isTRUE((as.integer(Sys.time()) - private $ last_reload ) > self $ config $ hot_reload_interval )
664
664
665
- if (! is.null(private $ asset_modtime ) && initiate_reload && (updated_assets || updated_root )) {
665
+ if (! is.null(current_asset_modtime ) && initiate_reload && (updated_assets || updated_root )) {
666
666
# refreshAssetMap silently returns a list of updated objects in the map
667
667
# we can use this to retrieve the modified files, and also determine if
668
668
# any are scripts or other non-CSS data
669
- updatedFiles <- private $ refreshAssetMap( )
669
+ has_assets <- file.exists(file.path(getAppPath(), private $ assets_folder ) )
670
670
671
- private $ modified_since_reload <- updatedFiles $ modified
672
-
673
- private $ asset_modtime <- current_asset_modtime
674
- # update the hash passed back to the renderer, and bump the timestamp
675
- # to match the current reloading event
671
+ if (has_assets ) {
672
+ updatedFiles <- private $ refreshAssetMap()
673
+ private $ modified_since_reload <- updatedFiles $ modified
674
+ private $ asset_modtime <- current_asset_modtime
675
+ # update the hash passed back to the renderer, and bump the timestamp
676
+ # to match the current reloading event
677
+ other_changed <- any(tools :: file_ext(updatedFiles $ modified ) != " css" )
678
+ other_added <- any(tools :: file_ext(updatedFiles $ added ) != " css" )
679
+ }
680
+
676
681
private $ updateReloadHash()
677
682
flush.console()
678
683
679
684
# if any filetypes other than CSS are encountered in those which
680
685
# are modified or deleted, restart the server
681
- other_changed <- any(tools :: file_ext(updatedFiles $ modified ) != " css" )
682
- other_added <- any(tools :: file_ext(updatedFiles $ added ) != " css" )
683
686
684
- hard_reload <- other_changed || other_added || updated_root
687
+ hard_reload <- updated_root || ( has_assets && other_changed || other_added )
685
688
686
689
if (! hard_reload ) {
687
690
# refresh the index but don't restart the server
0 commit comments