Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
de492c2
Initial plan
Copilot Aug 19, 2025
6d1fd3a
Initial exploration and understanding of the DB Switch double event i…
Copilot Aug 19, 2025
021d58e
Fix double event firing in DB Switch with Angular signals
Copilot Aug 19, 2025
439d623
Remove unrelated files from PR - keep only the actual DB Switch fix
Copilot Aug 20, 2025
60a48b4
docs: provide an example for a signal based switch
mfranzke Aug 20, 2025
85049c0
refactor: regenerated package lock file
mfranzke Aug 20, 2025
12e61ea
refactor: regenerated package lock file
mfranzke Aug 20, 2025
10eb8fd
Changes before error encountered
Copilot Sep 8, 2025
1755bcf
Update .gitignore
mfranzke Sep 8, 2025
90d15d5
refactor: updated package-lock.json file from main
mfranzke Sep 8, 2025
0b4163d
merge
mfranzke Sep 8, 2025
b069487
Merge branch 'main' into copilot/fix-4599
mfranzke Sep 12, 2025
f6cbf0d
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 19, 2025
6363166
fix(switch): prevent double change events by skipping props.onChange …
michaelmkraus Sep 25, 2025
5ed4406
chore(switch): remove console.log
michaelmkraus Sep 25, 2025
4138fb9
fix(switch): call onchange only if set
michaelmkraus Sep 25, 2025
26e222e
fix(switch): use old path to components
michaelmkraus Sep 25, 2025
75ff0ea
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 25, 2025
1a1429b
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 25, 2025
e1dc042
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 25, 2025
468b37d
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 26, 2025
a99d4a5
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 26, 2025
c3674be
Merge branch 'main' into copilot/fix-4599
nmerget Sep 29, 2025
babda15
chore: add changeset
nmerget Sep 29, 2025
b238811
Merge branch 'main' into copilot/fix-4599
mfranzke Sep 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ packages/components/src/**/*.css.map

.cache
**/playwright-report
**/blob-report/
/.parcel-cache/
/output/docs.json
showcases/patternhub/public/iframe-resizer/*
Expand Down
134 changes: 1 addition & 133 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions packages/components/src/utils/form-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ export const handleFrameworkEventAngular = (
event: any,
modelValue: string = 'value'
): void => {
// Change event to work with reactive and template driven forms
// Handle user-initiated change events for Angular forms integration
// According to Angular's ControlValueAccessor pattern:
// - propagateChange: notifies Angular forms of view → model updates (user interactions)
// - writeValue: should only be used for model → view updates (programmatic changes)
//
// For user-initiated events, propagateChange is sufficient. Calling writeValue
// during user events can cause double change detection cycles and redundant updates.
component.propagateChange(event.target[modelValue]);
component.writeValue(event.target[modelValue]);
};

export const handleFrameworkEventVue = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@
</db-button>
</fieldset>
</form>

<p>Switch with Angular signals</p>
<db-switch
[checked]="checkedSignal()"
(change)="handleChange($event)"
label="My Switch"
>
</db-switch>
</div>
<div>
<h1>Output</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
Component,
CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA
NO_ERRORS_SCHEMA,
signal
} from '@angular/core';
import {
FormControl,
Expand All @@ -16,6 +17,7 @@ import {
DBInput,
DBRadio,
DBSelect,
DBSwitch,
DBTabItem,
DBTabList,
DBTabPanel,
Expand Down Expand Up @@ -44,12 +46,16 @@ import { environment } from '../../../environments/environment';
DBTabs,
DBTabList,
DBTabItem,
DBTabPanel
DBTabPanel,
DBSwitch
],
standalone: true,
schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA]
})
export class FormComponent {
// DB Switch with Angular signals
checkedSignal = signal(false);

array = ['X', 'Y', 'Z'];
radio = '';
input = '';
Expand Down Expand Up @@ -150,4 +156,9 @@ export class FormComponent {
})
);
}

handleChange(event: any) {
console.log('Change event fired'); // Logged twice!
this.checkedSignal.set(event.target.checked);
}
}