Skip to content

Commit 9503d74

Browse files
authored
replace rlang::flatten_if() (#5223)
1 parent 1932002 commit 9503d74

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

R/facet-.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,14 @@ validate_facets <- function(x) {
332332

333333
# Flatten a list of quosures objects to a quosures object, and compact it
334334
compact_facets <- function(x) {
335-
x <- flatten_if(x, is_list)
335+
336+
proxy <- vec_proxy(x)
337+
is_list <- vapply(proxy, vec_is_list, logical(1))
338+
proxy[is_list] <- lapply(proxy[is_list], unclass)
339+
proxy[!is_list] <- lapply(proxy[!is_list], list)
340+
new <- list_unchop(proxy, ptype = list(), name_spec = "{outer}_{inner}")
341+
x <- vec_restore(new, x)
342+
336343
null_or_missing <- vapply(x, function(x) quo_is_null(x) || quo_is_missing(x), logical(1))
337344
new_quosures(x[!null_or_missing])
338345
}

0 commit comments

Comments
 (0)