From da65f9c7a3265662c93ef9bce8307ae8d52b1115 Mon Sep 17 00:00:00 2001 From: M Vargas Sepulveda Date: Sun, 10 May 2026 17:23:25 +0100 Subject: [PATCH] passing variable names as in #315 --- R/steps_and_briefs.R | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/R/steps_and_briefs.R b/R/steps_and_briefs.R index c9e465a32..e198e57a5 100644 --- a/R/steps_and_briefs.R +++ b/R/steps_and_briefs.R @@ -222,11 +222,15 @@ apply_preconditions <- function(tbl, preconditions) { } else if (rlang::is_formula(preconditions)) { - # Take the RHS of `preconditions` and eval with `eval_tidy()` + # Take the RHS of `preconditions` and eval with `eval_tidy()` in the + # formula's own environment. This preserves access to variables captured + # by closure when `preconditions` is built inside a wrapper function + # (e.g. supporting `{{ var }}` quasiquotation in user-defined helpers). preconditions <- - preconditions %>% - rlang::f_rhs() %>% - rlang::eval_tidy() + rlang::eval_tidy( + rlang::f_rhs(preconditions), + env = rlang::f_env(preconditions) + ) if (inherits(preconditions, "fseq")) {