Skip to content

Commit

Permalink
Don't hash the params to create unique ID, use uuid instead; related to
Browse files Browse the repository at this point in the history
  • Loading branch information
daattali committed Jul 10, 2020
1 parent 00d9009 commit aa8f72d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shinyalert
Title: Easily Create Pretty Popup Messages (Modals) in 'Shiny'
Version: 1.1
Version: 1.1.0.9000
Authors@R: c(
person("Dean", "Attali", email = "daattali@gmail.com",
role = c("aut", "cre"), comment = "R interface"),
Expand All @@ -15,9 +15,9 @@ BugReports: https://github.com/daattali/shinyalert/issues
Depends:
R (>= 3.0.2)
Imports:
digest,
shiny (>= 1.0.4),
stats
stats,
uuid
Suggests:
colourpicker,
knitr,
Expand Down
10 changes: 5 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# shinyalert 1.1
# shinyalert 1.2 Date TBD

2020-04-29
- Refactor of how unique IDs are created to ensure uniqueness in a performant way

# shinyalert 1.1 2020-04-29

- New feature (#11): `inputId` parameter added, which allows you to set the input ID that is used to retrieve the return value of the modal
- New feature (#12): support chaining modals, you can now call a shinyalert modal in the callback of another modal
Expand All @@ -10,8 +12,6 @@
- Documentation changes
- Improvements to demo shiny app UI

# shinyalert 1.0

2018-02-12
# shinyalert 1.0 2018-02-12

Initial release
11 changes: 1 addition & 10 deletions R/shinyalert.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,7 @@ shinyalert <- function(

# If an R callback function is provided, create an observer for it
if (!is.null(callbackR)) {

# Don't serialize the R callback because if it's a function, its entire
# enclosing environment will be captured and it can potentially be huge
# and slow
paramsSerialize <- params
paramsSerialize[['callbackR']] <- NULL

cbid <- sprintf("shinyalert-%s-%s",
digest::digest(paramsSerialize),
as.integer(stats::runif(1, 0, 1e9)))
cbid <- paste0("__shinyalert-", gsub("-", "", uuid::UUIDgenerate()))
params[['cbid']] <- session$ns(cbid)
shiny::observeEvent(session$input[[cbid]], {
if (length(formals(callbackR)) == 0) {
Expand Down

0 comments on commit aa8f72d

Please sign in to comment.