Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: layer with shared encoding ignore repeater #9246

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
13 changes: 10 additions & 3 deletions src/normalize/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class CoreNormalizer extends SpecMapper<NormalizerParams, FacetedUnitSpec
...(spec.name ? {name: [params.repeaterPrefix, spec.name].filter(n => n).join('_')} : {}),
...(encoding ? {encoding} : {})
};

if (parentEncoding || parentProjection) {
return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);
}
Expand Down Expand Up @@ -212,6 +211,7 @@ export class CoreNormalizer extends SpecMapper<NormalizerParams, FacetedUnitSpec

return super.mapFacet(spec, params);
}
//

private mapUnitWithParentEncodingOrProjection(
spec: FacetedUnitSpec<Field>,
Expand All @@ -224,14 +224,21 @@ export class CoreNormalizer extends SpecMapper<NormalizerParams, FacetedUnitSpec
parentEncoding,
encoding: replaceRepeaterInEncoding(encoding, params.repeater)
});

return this.mapUnit(
{
...spec,
...(mergedProjection ? {projection: mergedProjection} : {}),
...(mergedEncoding ? {encoding: mergedEncoding} : {})
},
{config}
isEmpty(encoding ?? {}) && !isEmpty(params.repeater ?? {})
? {
...params,
config: config,
repeater: params.repeater
}
: {
config
}
);
}

Expand Down