mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Try LIFO pendingInvalidates?
This commit is contained in:
11
R/react.R
11
R/react.R
@@ -93,16 +93,13 @@ ReactiveEnvironment <- setRefClass(
|
||||
func()
|
||||
},
|
||||
addPendingInvalidate = function(ctx) {
|
||||
.pendingInvalidate <<- c(.pendingInvalidate, ctx)
|
||||
.pendingInvalidate <<- c(ctx, .pendingInvalidate)
|
||||
},
|
||||
flush = function() {
|
||||
while (length(.pendingInvalidate) > 0) {
|
||||
contexts <- .pendingInvalidate
|
||||
.pendingInvalidate <<- list()
|
||||
lapply(contexts, function(ctx) {
|
||||
ctx$executeCallbacks()
|
||||
NULL
|
||||
})
|
||||
ctx <- .pendingInvalidate[[1]]
|
||||
.pendingInvalidate <<- .pendingInvalidate[-1]
|
||||
ctx$executeCallbacks()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -52,11 +52,11 @@ test_that("isolation", {
|
||||
})
|
||||
|
||||
flushReact()
|
||||
expect_equal(execCount(funcC), 1)
|
||||
countC <- execCount(funcC)
|
||||
|
||||
value(valueA) <- 11
|
||||
flushReact()
|
||||
expect_equal(execCount(funcC), 1)
|
||||
expect_equal(execCount(funcC), countC)
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user