Skip to content

Commit

Permalink
fix: use array for single item valueRefs in conditional if test exists
Browse files Browse the repository at this point in the history
  • Loading branch information
richardliu-db committed May 31, 2024
1 parent d69f22c commit 410514f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compile/mark/encode/conditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export function wrapCondition<CD extends ChannelDef | GuideEncodingConditionalVa
valueRefs.push(mainValueRef);
}

if (valueRefs.length > 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]};
Expand Down

0 comments on commit 410514f

Please sign in to comment.