log that invalidation has occured when an input value changes a key

This commit is contained in:
Barret Schloerke
2018-05-01 10:06:13 -04:00
parent 9564f1d871
commit 075ca49a1f
2 changed files with 18 additions and 0 deletions

View File

@@ -190,6 +190,9 @@ flushReact <- function() {
getCurrentContext <- function() {
.getReactiveEnvironment()$currentContext()
}
hasCurrentContext <- function() {
!is.null(.getReactiveEnvironment()$.currentContext)
}
getDummyContext <- function() {}
local({

View File

@@ -383,6 +383,21 @@ ReactiveValues <- R6Class(
# key has be depended upon (can not happen if the key is being set)
if (isTRUE(.hasRetrieved$keys[[key]])) {
rLog$valueChangeKey(.reactId, key, value, domain)
keyReactId <- rLog$keyIdStr(.reactId, key)
if (hasCurrentContext()) {
ctx <- getCurrentContext()
rLog$invalidateStart(keyReactId, ctx$id, ctx$.reactType, ctx$.domain)
on.exit(
rLog$invalidateEnd(keyReactId, ctx$id, ctx$.reactType, ctx$.domain),
add = TRUE
)
} else {
rLog$invalidateStart(keyReactId, NULL, "other", domain)
on.exit(
rLog$invalidateEnd(keyReactId, NULL, "other", domain),
add = TRUE
)
}
}
}
else {