diff --git a/R/utils.R b/R/utils.R index dec7b2ee..94820d6d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -577,8 +577,9 @@ get_asset_url <- function(asset_path, prefix = "/") { encode_plotly <- function(layout_objs) { if (is.list(layout_objs)) { - if ("x" %in% names(layout_objs) && - "visdat" %in% names(layout_objs$x)) { + if ("plotly" %in% class(layout_objs) && + "x" %in% names(layout_objs) && + any(c("visdat", "data") %in% names(layout_objs$x))) { # check to determine whether the current element is an # object output from the plot_ly or ggplotly function; # if it is, we can safely assume that it contains no