From 2bbe25c0c59888fc52ead32bfe2d1694ef3f2eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 10 Jul 2026 13:07:12 +0100 Subject: [PATCH 1/4] fix: only take label if it is a string --- R/resolver.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/resolver.R b/R/resolver.R index 048d5e4a..7adbc5c5 100644 --- a/R/resolver.R +++ b/R/resolver.R @@ -190,7 +190,14 @@ determine.values <- function(x, data) { # don't rename if names provided by app dev labels <- vapply( out, - FUN = function(choice) c(attr(data[[choice]], "label"), choice)[1], + FUN = function(choice) { + label <- attr(data[[choice]], "label") + if (checkmate::test_string(label)) { + label + } else { + choice + } + }, FUN.VALUE = character(1) ) stats::setNames(out, labels) From 9544cf501bb57d1bcba91929f2bb1a24b3f29f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 10 Jul 2026 13:29:46 +0100 Subject: [PATCH 2/4] docs: update news --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 34a5d240..8c477afa 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # teal.picks 0.1.0.9002 +### Bug fixes + +* Fixed a bug that crashes the `picks_srv` when datasets with labels that contain lists. Defaults to the choice name (#96). + ### Miscellaneous * `variables()` allows for custom `allow-clear` options to be set by user without being overwritten. From 56b9080c6a9e44062fa4ee11832cd8e12e7fdb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 10 Jul 2026 14:32:56 +0100 Subject: [PATCH 3/4] tests: adds test to prevent regressions --- tests/testthat/test-module_picks.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/testthat/test-module_picks.R b/tests/testthat/test-module_picks.R index 5fb7d3b4..89e03933 100644 --- a/tests/testthat/test-module_picks.R +++ b/tests/testthat/test-module_picks.R @@ -200,6 +200,17 @@ testthat::describe("picks_srv return a named list of reactive picks", { }) testthat::describe("picks_srv resolves datasets", { + it("that has a named list label", { + test_data <- list(CO2 = CO2) + test_picks <- picks(datasets(choices = c("CO2"), selected = "CO2")) + shiny::withReactiveDomain( + domain = shiny::MockShinySession$new(), + expr = testthat::expect_no_error( + picks_srv(id = "test", picks = test_picks, data = shiny::reactive(test_data)) + ) + ) + }) + it("provided non-delayed datasets are adjusted to possible datanames", { test_picks <- picks( datasets(choices = c(mtcars = "mtcars", notexisting = "notexisting"), selected = "mtcars") From 74b865294831eec603612cf77ecc04a6dada4329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Revilla?= <185338939+llrs-roche@users.noreply.github.com> Date: Tue, 14 Jul 2026 15:56:33 +0200 Subject: [PATCH 4/4] Update R/resolver.R --- R/resolver.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/resolver.R b/R/resolver.R index 7adbc5c5..0ee86083 100644 --- a/R/resolver.R +++ b/R/resolver.R @@ -191,7 +191,7 @@ determine.values <- function(x, data) { labels <- vapply( out, FUN = function(choice) { - label <- attr(data[[choice]], "label") + label <- attr(data[[choice]], "labels") if (checkmate::test_string(label)) { label } else {