diff --git a/.changeset/nice-steaks-train.md b/.changeset/nice-steaks-train.md new file mode 100644 index 0000000000..7348b8e20b --- /dev/null +++ b/.changeset/nice-steaks-train.md @@ -0,0 +1,5 @@ +--- +"@justeattakeaway/pie-modal": minor +--- + +[Changed] - SSR testing diff --git a/packages/components/pie-modal/src/index.ts b/packages/components/pie-modal/src/index.ts index 7494042a05..25a9a1763f 100644 --- a/packages/components/pie-modal/src/index.ts +++ b/packages/components/pie-modal/src/index.ts @@ -87,7 +87,7 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps { public isOpen = defaultProps.isOpen; @property({ type: Object }) - public leadingAction!: ActionProps; + public leadingAction: ModalProps['leadingAction']; @property() @validPropertyValues(componentSelector, positions, defaultProps.position) @@ -111,6 +111,14 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps { // Renders a `CSSResult` generated from SCSS by Vite static styles = unsafeCSS(styles); + constructor () { + super(); + console.log('isOpen in constructor', this.isOpen); + console.log('leadingAction in constructor', this.leadingAction); + console.log('position in constructor', this.position); + console.log('size in constructor', this.size); + } + connectedCallback () : void { super.connectedCallback(); this.addEventListener('click', (event) => this._handleDialogLightDismiss(event)); @@ -127,6 +135,10 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps { } async firstUpdated (changedProperties: PropertyValues) : Promise { + console.log('isOpen in firstUpdated', this.isOpen); + console.log('leadingAction in firstUpdated', this.leadingAction); + console.log('position in firstUpdated', this.position); + console.log('size in firstUpdated', this.size); super.firstUpdated(changedProperties); if (this._dialog) { @@ -300,6 +312,10 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps { * @private */ private renderLeadingAction () : TemplateResult | typeof nothing { + if (!this.leadingAction) { + return nothing; + } + const { text, variant = 'primary', ariaLabel } = this.leadingAction; if (!text) {