From 31f5c86bb2b97c12fa93d433410b519dd1985529 Mon Sep 17 00:00:00 2001 From: Carson Date: Tue, 20 Jun 2023 15:16:25 -0500 Subject: [PATCH 1/2] Close #640. Don't call shiny::restoreInput() inside accordion() if id isn't provided --- R/accordion.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/accordion.R b/R/accordion.R index 03644fc0d..cc0ac312a 100644 --- a/R/accordion.R +++ b/R/accordion.R @@ -56,7 +56,7 @@ accordion <- function(..., id = NULL, open = NULL, multiple = TRUE, class = NULL attrs <- args[nzchar(argnames)] children <- args[!nzchar(argnames)] - if (isNamespaceLoaded("shiny")) { + if (!is.null(id) && isNamespaceLoaded("shiny")) { open <- shiny::restoreInput(id = id, default = open) } From f0ccf97082871bb961db6614e51dab3b65ab2345 Mon Sep 17 00:00:00 2001 From: Carson Date: Wed, 21 Jun 2023 16:06:18 -0500 Subject: [PATCH 2/2] Update news --- NEWS.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index dd991c7ed..f4a13803b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,9 @@ # bslib 0.5.0.9000 -* Closed (#636): Outputs in sidebars now work as expected when an initially-closed sidebar is opened. (#624) +## Bug fixes + +* Closed #636: Outputs in sidebars now work as expected when an initially-closed sidebar is opened. (#624) +* Closed #640: `accordion()` no longer errors when an `id` isn't supplied inside a Shiny `session` context. (#646) # bslib 0.5.0