Spaces:
Running
Running
feat: Replace `reset_fetch()` with granular state resets and add UI freezing/unfreezing around plot rendering.
Browse files
server.R
CHANGED
|
@@ -942,7 +942,23 @@ server <- function(input, output, session) {
|
|
| 942 |
|
| 943 |
station_fetching(FALSE)
|
| 944 |
loading_status(FALSE)
|
| 945 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 946 |
|
| 947 |
# Navigate to Dashboard only after data is ready
|
| 948 |
updateNavbarPage(session, "main_nav", selected = "Dashboard")
|
|
|
|
| 942 |
|
| 943 |
station_fetching(FALSE)
|
| 944 |
loading_status(FALSE)
|
| 945 |
+
fetch_stage(0)
|
| 946 |
+
fetch_current_token(as.numeric(Sys.time()))
|
| 947 |
+
|
| 948 |
+
if (!is.null(merged_df) && nrow(merged_df) > 0) {
|
| 949 |
+
# Show "Plotting data..." while plots render
|
| 950 |
+
session$sendCustomMessage("freezeUI", list(
|
| 951 |
+
text = "Plotting data...",
|
| 952 |
+
station = st$name[1]
|
| 953 |
+
))
|
| 954 |
+
|
| 955 |
+
# Unfreeze after Shiny finishes flushing all outputs (plots rendered)
|
| 956 |
+
session$onFlushed(function() {
|
| 957 |
+
session$sendCustomMessage("unfreezeUI", list())
|
| 958 |
+
}, once = TRUE)
|
| 959 |
+
} else {
|
| 960 |
+
session$sendCustomMessage("unfreezeUI", list())
|
| 961 |
+
}
|
| 962 |
|
| 963 |
# Navigate to Dashboard only after data is ready
|
| 964 |
updateNavbarPage(session, "main_nav", selected = "Dashboard")
|