Repository navigation
fix(forms): clear hidden CippFormCondition fields in production builds - #947
Merged
KelvinTegelaar merged 1 commit intoOct 16, 2026
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #946
Problem
CippFormConditioncleared hidden fields by matchingchild.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 theCippForm*Selectorwrappers (group, license, tenant, user), which never matched even in dev.clearFieldsstays as the explicit override for composite children.Tests
CippFormCondition.test.jsxblanks the child component's name to simulate minification. It fails ondevand passes with the fix, and all 16 tests in the file pass.eslint: the file's existing rules-of-hooks errors are pre-existing ondevand untouched.