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 (cherry-pick v7) #4151

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 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
2 changes: 1 addition & 1 deletion packages/styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"start": "gulp watch",
"build": "pnpm clean && gulp build",
"unit": "gulp sass:tests",
"clean": "rimraf out-tsc dist",
"clean": "rimraf out-tsc dist src/tokens/temp",
"format": "prettier src/**/*.scss --write",
"lint": "stylelint src/**/*.scss",
"lint:fix": "stylelint src/**/*.scss --fix"
Expand Down
4 changes: 3 additions & 1 deletion packages/tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"type": "module",
"scripts": {
"build": "node ./build.js"
"build": "pnpm clean && node ./build.js",
"clean": "rimraf dist"
},
"keywords": [
"tokens",
Expand All @@ -33,6 +34,7 @@
},
"devDependencies": {
"@tokens-studio/sd-transforms": "0.16.1",
"rimraf": "6.0.1",
"style-dictionary": "4.0.0"
}
}
17 changes: 10 additions & 7 deletions pnpm-lock.yaml

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

Loading