Skip to content

Commit

Permalink
fix: search entire ancestry for closest facet model
Browse files Browse the repository at this point in the history
  • Loading branch information
drgould authored and BradyJ27 committed Oct 19, 2023
1 parent da5e223 commit 76997ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/compile/selection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,15 @@ export const selectionCompilers: SelectionCompiler[] = [
];

export function getFacetParentModel(model: Model): FacetModel | null {
return isFacetModel(model.parent) ? model.parent : null;
let parent = model.parent;
while (parent) {
if (isFacetModel(parent)) {
return parent;
}
parent = parent.parent;
}

return null;
}

export function unitName(model: Model, {escape} = {escape: true}) {
Expand Down

0 comments on commit 76997ea

Please sign in to comment.