Skip to content

Add Config.include.emptyVariants to support filtering layered variants without elements #83

@nathanacurtis

Description

@nathanacurtis

Summary

The anova-plugin UI exposes an "Include layered variants without elements" checkbox setting (DATA_EMPTY_VARIANTS in src/UI/App/Settings/VariantsChildren.ts), but toggling it has no effect on the transformer output. The setting is purely cosmetic — it persists in localStorage but is never passed through to the transformer pipeline.

Root Cause

There are three breaks in the chain between the UI setting and the transformer behavior:

1. No Config field exists (anova)

Config.include only defines three fields:

include: {
  variantNames: boolean;
  invalidVariants: boolean;
  invalidCombinations: boolean;
};

There is no emptyVariants (or equivalent) field for the transformer to read.

2. Setting is not mapped to Config (anova-plugin)

In anova-plugin/src/Anova.ts, the settingsToModelConfig() function maps plugin settings to the transformer's Config object. Other include-related settings are mapped:

  • DATA_VARIANT_NAMESinclude.variantNames
  • DATA_INVALID_VARIANTinclude.invalidVariants
  • DATA_INVALID_COMBINATIONSinclude.invalidCombinations

But DATA_EMPTY_VARIANTS is not included in this mapping function.

3. No filtering logic in the transformer (anova-transformer)

Variant.data() in src/Component/Variants/Variant.ts and Variants.data() in src/Component/Variants/Variants.ts have no logic to filter out variants based on whether they contain elements. All valid variants are always included in the output regardless of element presence.

Scope (this issue)

This issue covers step 1 only: adding the emptyVariants field to Config.include in the @directededges/anova package.

Changes required

  • Add emptyVariants: boolean to the Config.include type definition
  • Add emptyVariants to the JSON schema for Config
  • Set the default value (likely false, matching the plugin's default
  • Update any Config construction/validation helpers

Downstream work (separate issues)

  • anova-transformer: Read and filter out layered variants that contain no elements when set to
  • anova-plugin: Wire → in
  • anova-kit (CLI/REST): Expose the setting if applicable

Affected Files

Repo File Change
Add to
JSON schema definition Add property
(downstream) Add filtering logic
(downstream) Pass config through
(downstream) Map setting to config
EOF
)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Ready to release

Relationships

None yet

Development

No branches or pull requests

Issue actions