Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check props on componentDidLoad #3775 #3796

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
7 changes: 7 additions & 0 deletions .changeset/tiny-socks-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@swisspost/design-system-components': patch
'@swisspost/design-system-components-angular': patch
'@swisspost/design-system-components-react': patch
---

Fixed an issue with property validation where some checks were run before the framework had the chance to add computed properties (for example Angular bindings like `[for]="$id"`). The checks are now delayed to work around this issue.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class PostAccordionItem {
);
}

connectedCallback() {
componentDidLoad() {
this.validateHeadingLevel();
}

Expand All @@ -51,7 +51,10 @@ export class PostAccordionItem {
// capture to make sure the "collapsed" property is updated before the event is consumed
@Listen('postToggle', { capture: true })
onCollapseToggle(event: CustomEvent<boolean>): void {
if (event.target === this.host && (event.target as HTMLElement).localName === 'post-accordion-item') {
if (
event.target === this.host &&
(event.target as HTMLElement).localName === 'post-accordion-item'
) {
this.collapsed = !event.detail;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class PostAlert {
*/
@Event() postDismissed: EventEmitter<void>;

connectedCallback() {
componentDidLoad() {
this.validateDismissible();
this.validateFixed();
this.validateIcon();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class PostIcon {
checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
}

componentWillLoad() {
componentDidLoad() {
this.validateBase();
this.validateName();
this.validateFlipH();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class PostLogo {
checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
}

connectedCallback() {
componentDidLoad() {
this.validateUrl();
this.checkDescription();
}
Expand Down
Loading