Skip to content

Commit 021d58e

Browse files
Copilotmfranzke
andcommitted
Fix double event firing in DB Switch with Angular signals
Co-authored-by: mfranzke <[email protected]>
1 parent 6d1fd3a commit 021d58e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
19.8 KB
Binary file not shown.

packages/components/src/utils/form-components.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ export const handleFrameworkEventAngular = (
66
): void => {
77
// Change event to work with reactive and template driven forms
88
component.propagateChange(event.target[modelValue]);
9-
component.writeValue(event.target[modelValue]);
9+
10+
// Skip writeValue for user-initiated change events on signal-based properties
11+
// to prevent double event firing. The propagateChange call above is sufficient
12+
// for notifying Angular forms of the change.
13+
// For signal-based properties like 'checked', the component's signal will be
14+
// updated through the normal Angular change detection cycle.
15+
const isSignalBasedProperty = modelValue === 'checked' || modelValue === 'disabled';
16+
if (!isSignalBasedProperty) {
17+
component.writeValue(event.target[modelValue]);
18+
}
1019
};
1120

1221
export const handleFrameworkEventVue = (

0 commit comments

Comments
 (0)