fix(key-value): revalidate key control when forbidden keys change after deletion#35455
Merged
adrianjm-dotCMS merged 1 commit intomainfrom Apr 24, 2026
Merged
Conversation
…er deletion When a conflicting key/value entry was deleted, the duplicate key error remained on the input because Angular only re-runs validators on value change. An effect now watches the $forbiddenkeys signal and calls updateValueAndValidity() to keep validation in sync with the list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Claude finished @adrianjm-dotCMS's task in 37s —— View job Rollback Safety Analysis
Result: ✅ Safe to Roll BackChanges analyzed:
Verdict against every unsafe category:
This PR touches only an Angular UI component and its test. No database migrations, Elasticsearch mapping changes, REST/GraphQL contract modifications, or backend code of any kind are involved. Rolling back to N-1 has zero risk. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a reactive-forms validation staleness bug in the Key/Value UI component so that the “duplicate key” error is cleared when the conflicting key is removed from the forbidden-keys map (e.g., after deleting an entry).
Changes:
- Added an Angular
effect()inDotKeyValueTableHeaderRowComponentto re-run key validation whenever theforbiddenkeyssignal input changes. - Added a regression unit test verifying the
duplicatedKeyerror is cleared afterforbiddenkeysis updated.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| core-web/libs/ui/src/lib/components/dot-key-value-ng/dot-key-value-table-header-row/dot-key-value-table-header-row.component.ts | Revalidates the key control when forbiddenkeys changes by triggering updateValueAndValidity() inside an effect(). |
| core-web/libs/ui/src/lib/components/dot-key-value-ng/dot-key-value-table-header-row/dot-key-value-table-header-row.component.spec.ts | Adds a regression test ensuring duplicatedKey is cleared when the conflicting key is removed from forbiddenkeys. |
dario-daza
approved these changes
Apr 24, 2026
oidacra
approved these changes
Apr 24, 2026
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.
Problem
When a user typed a duplicate key in the Key/Value field, the
duplicatedKeyvalidation error appeared correctly. But if the original conflicting entry was deleted, the error remained on the input — preventing the user from saving — even though the conflict no longer existed.VIDEO
Screen.Recording.2026-04-24.at.2.53.47.PM.mov
Root Cause
The
keyValidator()inDotKeyValueTableHeaderRowComponentreads the$forbiddenkeyssignal at validation time. Angular reactive forms, however, only re-run validators when the control's value changes — not when an external signal changes. So when$forbiddenkeysupdated after a deletion, the key control had no reason to revalidate.Fix
Added a constructor
effect()that watches$forbiddenkeysand callskeyControl.updateValueAndValidity({ emitEvent: false })whenever the forbidden keys map changes. This forces Angular to re-run the validator with the updated map.Test
Added a regression test that:
forbiddenkeysinput to empty map (simulating deletion of the conflicting entry)Closes
Closes #32114
This PR fixes: #32114