From dec6c30f8fa2e9a6247ca8279836799bfc210236 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Mon, 27 Nov 2023 16:02:12 -0500 Subject: [PATCH] fix: Restores eager recursion into `options` objects (#478) --- NEWS.md | 2 ++ R/utils.R | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 92a4d22..f545702 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # htmlwidgets (development version) +* htmlwidgets once again eagerly recurses into list-like objects when searching for JavaScript strings wrapped in `JS()`. If you encounter an infinite recursion ("C stack usage is too close to the limit"), the best strategy is to coerce the offending items to a character string. (#478) + # htmlwidgets 1.6.3 ### Potentially breaking changes diff --git a/R/utils.R b/R/utils.R index a43a5ad..ef582ea 100644 --- a/R/utils.R +++ b/R/utils.R @@ -161,7 +161,8 @@ JSEvals <- function(list) { #' @noRd #' @keywords internal shouldEval <- function(options) { - if (inherits(options, c("list", "data.frame"))) { + if (is.list(options)) { + if (inherits(options, "POSIXlt")) return(FALSE) if ((n <- length(options)) == 0) return(FALSE) # use numeric indices as names (remember JS indexes from 0, hence -1 here) if (is.null(names(options)))