Skip to content

Commit b1d8fd1

Browse files
authored
fix: do not throw on requestContentUpdate before attach (#5285)
1 parent 058f71e commit b1d8fd1

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/dialog/src/vaadin-dialog.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,9 @@ class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixin(Dialog
619619
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
620620
*/
621621
requestContentUpdate() {
622-
this.$.overlay.requestContentUpdate();
622+
if (this.$) {
623+
this.$.overlay.requestContentUpdate();
624+
}
623625
}
624626

625627
/** @private */

‎packages/dialog/test/renderer.test.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ describe('vaadin-dialog renderer', () => {
3535
expect(dialog.renderer.calledTwice).to.be.true;
3636
});
3737

38+
it('should not throw when requesting content update for an unupgraded dialog', () => {
39+
const dialog = document.createElement('vaadin-dialog');
40+
41+
expect(() => dialog.requestContentUpdate()).not.to.throw();
42+
});
43+
3844
it('should clear the content when removing the renderer', () => {
3945
dialog.renderer = (root) => {
4046
root.innerHTML = 'foo';

0 commit comments

Comments
 (0)