diff --git a/NEWS.md b/NEWS.md index 6c444cd08f..3e5ba492ef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # ggplot2 (development version) +* Fixed performance loss when the `.data` pronoun is used in `aes()` (#5730). * Fixed bug where discrete scales could not map aesthetics only consisting of `NA`s (#5623) * Facet evaluation is better at dealing with inherited errors diff --git a/R/aes.R b/R/aes.R index 87870bccb1..4120657222 100644 --- a/R/aes.R +++ b/R/aes.R @@ -430,7 +430,7 @@ alternative_aes_extract_usage <- function(x) { } extract_target_is_likely_data <- function(x, data, env) { - if (!is.name(x[[2]])) { + if (!is.name(x[[2]]) || identical(x[[2]], quote(.data))) { return(FALSE) }