Skip to content

Commit

Permalink
fix: replace childElement when component is updated (fix #2028) (#2029)
Browse files Browse the repository at this point in the history
Co-authored-by: pschult <paul.schult@wspsoft.de>
  • Loading branch information
PaulSchult and pschult authored Dec 2, 2021
1 parent 1a560e5 commit 1f2abfc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/editor/src/ui/components/toolbar/customPopupBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export class CustomPopupBody extends Component<Props> {
this.refs.el.appendChild(this.props.body);
}

updated(prevProps: Props) {
// update custom popup element
this.refs.el.replaceChild(this.props.body, prevProps.body);
}

render() {
return html`<div ref=${(el: HTMLElement) => (this.refs.el = el)}></div>`;
}
Expand Down

0 comments on commit 1f2abfc

Please sign in to comment.