From fbdb55bf561afa6da55109ebe91b7d83f50f8655 Mon Sep 17 00:00:00 2001 From: Richard Liu Date: Fri, 31 May 2024 13:23:37 -0700 Subject: [PATCH] fix: use array for single item valueRefs in conditional if test exists --- src/compile/mark/encode/conditional.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compile/mark/encode/conditional.ts b/src/compile/mark/encode/conditional.ts index 7a9aca8082..8985d71943 100644 --- a/src/compile/mark/encode/conditional.ts +++ b/src/compile/mark/encode/conditional.ts @@ -58,7 +58,10 @@ export function wrapCondition 1) { + if ( + valueRefs.length > 1 || + (valueRefs.length === 1 && Boolean(valueRefs[0].test)) // We must use array form valueRefs if test exists, otherwise Vega won't execute the test. + ) { return {[vgChannel]: valueRefs}; } else if (valueRefs.length === 1) { return {[vgChannel]: valueRefs[0]};