Skip to content

Commit b0676b8

Browse files
committed
Trigger shiny:recalculated after the calculation is done
1 parent 83c3656 commit b0676b8

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

R/shiny.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,9 @@ ShinySession <- R6Class(
471471

472472
obs <- observe({
473473

474-
self$sendCustomMessage('recalculating', list(name = name))
474+
self$sendCustomMessage('recalculating', list(
475+
name = name, status = 'recalculating'
476+
))
475477

476478
value <- try(
477479
{
@@ -493,6 +495,10 @@ ShinySession <- R6Class(
493495
silent=FALSE
494496
)
495497

498+
self$sendCustomMessage('recalculating', list(
499+
name = name, status = 'recalculated'
500+
))
501+
496502
private$invalidatedOutputErrors$remove(name)
497503
private$invalidatedOutputValues$remove(name)
498504

srcjs/shinyapp.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,11 @@ var ShinyApp = function() {
508508
});
509509

510510
addCustomMessageHandler('recalculating', function(message) {
511-
if (message.hasOwnProperty('name')) return;
512-
$('#' + message.name).trigger({
513-
type: 'shiny:recalculating'
514-
});
511+
if (message.hasOwnProperty('name') && message.hasOwnProperty('status')) {
512+
$('#' + message.name).trigger({
513+
type: 'shiny:' + message.status
514+
});
515+
}
515516
});
516517

517518

0 commit comments

Comments
 (0)