From 172366ace97f14c6fea2f333d8cbc9f8a6427756 Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Fri, 14 Nov 2025 19:53:08 +0100 Subject: [PATCH 1/6] Handle vctrs_list_of in boxAtomicScalarElements Closes https://github.com/rstudio/DT/issues/1180 --- R/utils.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/utils.R b/R/utils.R index 5b860d83..811ad371 100644 --- a/R/utils.R +++ b/R/utils.R @@ -44,6 +44,9 @@ captionString = function(caption) { boxAtomicScalarElements = function(x) { is_atomic = vapply(x, is.atomic, logical(1)) if (all(is_atomic)) { + if (inherits(x, "vctrs_list_of")) { + x <- as.list(x) + } is_scalar = lengths(x) == 1L x[is_scalar] = lapply(x[is_scalar], list) } From d042d83acaf1ed8a5823bcd28676a421e29f9289 Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Fri, 14 Nov 2025 20:10:47 +0100 Subject: [PATCH 2/6] Add test for boxAtomicScalarElements with vctrs::list_of --- tests/testit/test-utils.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/testit/test-utils.R b/tests/testit/test-utils.R index 46b1578f..43754d28 100644 --- a/tests/testit/test-utils.R +++ b/tests/testit/test-utils.R @@ -5,6 +5,18 @@ assert('dropNULL() works', { (dropNULL(list(a = 1, b = NULL)) %==% list(a = 1)) }) +assert('boxAtomicScalarElements() works with vctrs::list_of lists', { + if (requireNamespace("vctrs", quietly = TRUE)) { + val1 <- list("a", c("a", "b")) + out1 <- boxAtomicScalarElements(val1) + val2 <- vctrs::as_list_of(val1) + out2 <- boxAtomicScalarElements(val2) + (out1 %==% out2) + } else { + message("test omitted: vctrs is not installed") + } +}) + assert('upperToDash() works', { (upperToDash('fontWeight') %==% 'font-weight') (upperToDash('backgroundColor') %==% 'background-color') From ab16b6f31e43b32b023db2ce515928b38a3917b0 Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Fri, 14 Nov 2025 20:11:32 +0100 Subject: [PATCH 3/6] Fix test omission message for vctrs installation --- tests/testit/test-utils.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testit/test-utils.R b/tests/testit/test-utils.R index 43754d28..01f79b93 100644 --- a/tests/testit/test-utils.R +++ b/tests/testit/test-utils.R @@ -14,6 +14,7 @@ assert('boxAtomicScalarElements() works with vctrs::list_of lists', { (out1 %==% out2) } else { message("test omitted: vctrs is not installed") + TRUE } }) From 713051e219d9a14b053587ca1019f20f80597b5f Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Fri, 14 Nov 2025 20:28:32 +0100 Subject: [PATCH 4/6] Update NEWS entry --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 0770b272..7a94aca6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # DT (development version) +- Fix error rendering `vctrs::list_of` columns (#1180, @zeehio) + # CHANGES IN DT VERSION 0.34 - DT is now released under the MIT license (previously GPL-3) (#1175). From 89934134fa7eb961e8998f1642dfacad8d24d732 Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Fri, 14 Nov 2025 20:49:54 +0100 Subject: [PATCH 5/6] Add vctrs dependency for test coverage --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index b6a857c2..a83abbcd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -50,7 +50,8 @@ Suggests: rmarkdown, shiny (>= 1.6), testit, - tibble + tibble, + vctrs VignetteBuilder: knitr Encoding: UTF-8 From d46788c0d4e46d32fb9c75ff418e5362f9789f82 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Tue, 9 Dec 2025 08:35:37 -0500 Subject: [PATCH 6/6] chore: tweak news bullet --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 7a94aca6..0ffb6936 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # DT (development version) -- Fix error rendering `vctrs::list_of` columns (#1180, @zeehio) +- `datatable()` now renders data frames with `vctrs::list_of()` list-columns (#1180, @zeehio). # CHANGES IN DT VERSION 0.34