Skip to content

Commit

Permalink
Fix rstudio/reactlog#36: Changes to reactive values not displaying ac…
Browse files Browse the repository at this point in the history
…curately
  • Loading branch information
jcheng5 committed May 7, 2019
1 parent e6c2133 commit 8a07314
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions R/reactives.R
Original file line number Diff line number Diff line change
Expand Up @@ -395,24 +395,21 @@ ReactiveValues <- R6Class(
# set the value for better logging
.values[[key]] <- value

if (key_exists) {
# key has been 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)
rLog$invalidateStart(keyReactId, NULL, "other", domain)
on.exit(
rLog$invalidateEnd(keyReactId, NULL, "other", domain),
add = TRUE
)
}
# key has been depended upon
if (isTRUE(.hasRetrieved$keys[[key]])) {
rLog$valueChangeKey(.reactId, key, value, domain)
keyReactId <- rLog$keyIdStr(.reactId, key)
rLog$invalidateStart(keyReactId, NULL, "other", domain)
on.exit(
rLog$invalidateEnd(keyReactId, NULL, "other", domain),
add = TRUE
)
}

} else {
# only invalidate if there are deps
if (isTRUE(.hasRetrieved$names)) {
rLog$valueChangeNames(.reactId, ls(.values, all.names = TRUE), domain)
.namesDeps$invalidate()
}
# only invalidate if there are deps
if (!key_exists && isTRUE(.hasRetrieved$names)) {
rLog$valueChangeNames(.reactId, ls(.values, all.names = TRUE), domain)
.namesDeps$invalidate()
}

if (hidden) {
Expand Down

0 comments on commit 8a07314

Please sign in to comment.