From dc6455fcc991fa963ad949485e70d806cd159daa Mon Sep 17 00:00:00 2001 From: Dan Gealow Date: Fri, 26 Apr 2024 20:34:29 -0400 Subject: [PATCH] Isolate `names(...)` in `event_data()` to prevent spurious updates (#2339) * Isolate names(session$userData$plotlyInputStore) to prevent spurious updates (#2337) * Update NEWS.md --- NEWS.md | 4 ++++ R/shiny.R | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 7471198093..f56c1cf414 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # plotly (development version) +## Bug fixes + +* Closed #2337: Creating a new `event_data()` handler no longer causes a spurious reactive update of existing `event_data()`s. (#2339) + # 4.10.4 ## Improvements diff --git a/R/shiny.R b/R/shiny.R index 583b4492f8..a25b653aac 100644 --- a/R/shiny.R +++ b/R/shiny.R @@ -193,7 +193,7 @@ event_data <- function( } else { - eventHasStorage <- eventID %in% names(session$userData$plotlyInputStore) + eventHasStorage <- eventID %in% shiny::isolate(names(session$userData$plotlyInputStore)) if (!eventHasStorage) { # store input value as a reactive value to leverage caching