Compare commits

...

1 Commits

Author SHA1 Message Date
Joe Cheng
b414ae512a Use destroy instead of suspend on obsolete outputs
When replacing one output with another, we were calling suspend
on the old output's observer object. This prevents the observer
from being scheduled in the future, but it doesn't prevent an
already-scheduled execution from proceeding. Since we have a new
definition for what an output is, there's no way another execution
of the old observer will do anything useful.

One simple way to see the difference this commit makes is to
create a simple Shiny app that sets output$plot twice in server.R,
with a println in each renderPlot. You'll see that both execute
once, whereas with this change only the most recently set renderPlot
gets executed.
2015-12-03 19:41:06 -08:00

View File

@@ -526,9 +526,9 @@ ShinySession <- R6Class(
# name not working unless name was eagerly evaluated. Yikes!
force(name)
# If overwriting an output object, suspend the previous copy of it
# If overwriting an output object, destroy the previous copy of it
if (!is.null(private$.outputs[[name]])) {
private$.outputs[[name]]$suspend()
private$.outputs[[name]]$destroy()
}
if (is.function(func)) {