Skip to content

fix(forms): clear hidden CippFormCondition fields in production builds - #947

Merged
KelvinTegelaar merged 1 commit into
CyberDrain:devfrom
kris6673:fix/form-condition-clear-on-hide
Oct 16, 2026
Merged

KelvinTegelaar merged 1 commit into
CyberDrain:devfrom
kris6673:fix/form-condition-clear-on-hide

Conversation

@kris6673

Copy link
Copy Markdown
Contributor

Closes #946

Problem

CippFormCondition cleared hidden fields by matching child.type.name === "CippFormComponent". Production minification empties function names, so nothing matched and hidden fields kept submitting stale values. For example, the Deploy Policy drawer still assigned a previously picked custom group after switching to All Devices. Dev and vitest keep function names, so this only shows on built frontends.

Fix

Identify fields by their props (name + formControl) instead of by component name. This also covers the CippForm*Selector wrappers (group, license, tenant, user), which never matched even in dev. clearFields stays as the explicit override for composite children.

Tests

  • New vitest case in CippFormCondition.test.jsx blanks the child component's name to simulate minification. It fails on dev and passes with the fix, and all 16 tests in the file pass.
  • eslint: the file's existing rules-of-hooks errors are pre-existing on dev and untouched.

CippFormCondition found the fields to clear on hide by matching
child.type.name against "CippFormComponent". Production minification
empties function names, so nothing matched and hidden fields submitted
stale values (e.g. the Deploy Policy drawer kept a previously picked
custom group after switching to All Devices). Dev and vitest keep
names, so it only showed on built frontends.

Match on the name + formControl props instead. This also covers the
CippForm*Selector wrappers, which never matched even in dev.

Closes CyberDrain#946
@KelvinTegelaar
KelvinTegelaar merged commit c588431 into CyberDrain:dev Oct 16, 2026
16 checks passed
@kris6673
kris6673 deleted the fix/form-condition-clear-on-hide branch October 16, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants